We revised the analysis code after receiving peer-review comments. A series of Binomial regression analyses were added. Analyses for the second generation were added. The visualization codes were slightly revised.
$Note.$ The section titles with parenthesis "()" are additional analyses which were not reported in the manuscript.
library(stringr)
library(dplyr)
library(reshape)
library(ggplot2)
library(psych)
library(viridis)
library(scales)
library(rcartocolor)
library(effsize)
library(extrafont)
library(tidyverse)
library(magrittr)
library(apaTables)
library(MBESS)
library(xtable)
library(Hmisc)
library(modelsummary)
Attaching package: ‘dplyr’
The following objects are masked from ‘package:stats’:
filter, lag
The following objects are masked from ‘package:base’:
intersect, setdiff, setequal, union
Attaching package: ‘reshape’
The following object is masked from ‘package:dplyr’:
rename
Attaching package: ‘psych’
The following objects are masked from ‘package:ggplot2’:
%+%, alpha
Loading required package: viridisLite
Attaching package: ‘viridis’
The following object is masked from ‘package:viridisLite’:
viridis.map
Attaching package: ‘scales’
The following object is masked from ‘package:viridis’:
viridis_pal
The following objects are masked from ‘package:psych’:
alpha, rescale
Attaching package: ‘effsize’
The following object is masked from ‘package:psych’:
cohen.d
Registering fonts with R
── Attaching packages ─────────────────────────────────────── tidyverse 1.3.1 ──
✔ tibble 3.1.6 ✔ purrr 0.3.4
✔ tidyr 1.1.3 ✔ forcats 0.5.1
✔ readr 1.4.0
── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
✖ psych::%+%() masks ggplot2::%+%()
✖ scales::alpha() masks psych::alpha(), ggplot2::alpha()
✖ readr::col_factor() masks scales::col_factor()
✖ purrr::discard() masks scales::discard()
✖ tidyr::expand() masks reshape::expand()
✖ dplyr::filter() masks stats::filter()
✖ dplyr::lag() masks stats::lag()
✖ reshape::rename() masks dplyr::rename()
Warning message:
“package ‘magrittr’ was built under R version 4.0.5”
Attaching package: ‘magrittr’
The following object is masked from ‘package:purrr’:
set_names
The following object is masked from ‘package:tidyr’:
extract
Attaching package: ‘MBESS’
The following object is masked from ‘package:psych’:
cor2cov
Loading required package: lattice
Loading required package: survival
Loading required package: Formula
Attaching package: ‘Hmisc’
The following objects are masked from ‘package:xtable’:
label, label<-
The following object is masked from ‘package:psych’:
describe
The following objects are masked from ‘package:dplyr’:
src, summarize
The following objects are masked from ‘package:base’:
format.pval, units
Attaching package: ‘modelsummary’
The following object is masked from ‘package:Hmisc’:
Mean
The following object is masked from ‘package:psych’:
SD
sessionInfo()
R version 4.0.3 (2020-10-10) Platform: x86_64-apple-darwin17.0 (64-bit) Running under: macOS Big Sur 10.16 Matrix products: default BLAS: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRblas.dylib LAPACK: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRlapack.dylib locale: [1] ja_JP.UTF-8/ja_JP.UTF-8/ja_JP.UTF-8/C/ja_JP.UTF-8/ja_JP.UTF-8 attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] modelsummary_1.4.3 Hmisc_4.6-0 Formula_1.2-4 survival_3.2-7 [5] lattice_0.20-41 xtable_1.8-4 MBESS_4.9.2 apaTables_2.0.8 [9] magrittr_2.0.2 forcats_0.5.1 purrr_0.3.4 readr_1.4.0 [13] tidyr_1.1.3 tibble_3.1.6 tidyverse_1.3.1 extrafont_0.19 [17] effsize_0.8.1 rcartocolor_2.0.0 scales_1.1.1 viridis_0.5.1 [21] viridisLite_0.4.0 psych_2.0.12 ggplot2_3.3.5 reshape_0.8.8 [25] dplyr_1.0.7 stringr_1.4.0 loaded via a namespace (and not attached): [1] nlme_3.1-149 fs_1.5.0 lubridate_1.7.10 [4] insight_0.19.7 RColorBrewer_1.1-2 httr_1.4.2 [7] repr_1.1.0 tools_4.0.3 backports_1.2.1 [10] DT_0.17 utf8_1.2.2 R6_2.5.1 [13] rpart_4.1-15 DBI_1.1.1 colorspace_2.0-2 [16] nnet_7.3-14 withr_2.4.3 tidyselect_1.1.1 [19] gridExtra_2.3 mnormt_2.0.2 compiler_4.0.3 [22] extrafontdb_1.0 cli_3.1.1 rvest_1.0.0 [25] htmlTable_2.4.1 xml2_1.3.2 checkmate_2.1.0 [28] tables_0.9.17 pbdZMQ_0.3-4 digest_0.6.29 [31] foreign_0.8-80 rmarkdown_2.9 base64enc_0.1-3 [34] jpeg_0.1-9 pkgconfig_2.0.3 htmltools_0.5.0 [37] dbplyr_2.1.1 htmlwidgets_1.5.3 rlang_1.0.1 [40] readxl_1.3.1 rstudioapi_0.13 generics_0.1.2 [43] jsonlite_1.7.2 interp_1.0-33 Matrix_1.2-18 [46] Rcpp_1.0.9 IRkernel_1.1.1.9000 munsell_0.5.0 [49] fansi_1.0.2 lifecycle_1.0.1 stringi_1.5.3 [52] plyr_1.8.6 grid_4.0.3 parallel_4.0.3 [55] crayon_1.4.2 deldir_1.0-6 IRdisplay_0.7.0 [58] haven_2.3.1 splines_4.0.3 hms_1.1.0 [61] tmvnsim_1.0-2 knitr_1.30 pillar_1.7.0 [64] uuid_0.1-4 reprex_2.0.0 glue_1.6.1 [67] evaluate_0.14 latticeExtra_0.6-30 data.table_1.13.6 [70] modelr_0.1.8 vctrs_0.3.8 png_0.1-7 [73] Rttf2pt1_1.3.12 cellranger_1.1.0 gtable_0.3.0 [76] assertthat_0.2.1 xfun_0.24 broom_0.7.6 [79] cluster_2.1.0 ellipsis_0.3.2
df<-read.csv("maindata.csv")
head(df)
| ID | ChainID | Generation | ExpCondition | Age | Gender | Trial | Choice | Length | Width | Thickness | Fitness | erroredFitness | EarnedMoney | TimeStamp | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| <chr> | <int> | <int> | <chr> | <int> | <int> | <int> | <int> | <int> | <int> | <int> | <int> | <int> | <dbl> | <dbl> | |
| 1 | I1 | 1 | 1 | I | 20 | 1 | 1 | 1 | 14 | 6 | 83 | 364 | 373 | 14.92 | 2.022012e+13 |
| 2 | I1 | 1 | 1 | I | 20 | 1 | 2 | 2 | 19 | 6 | 83 | 394 | 373 | 14.92 | 2.022012e+13 |
| 3 | I1 | 1 | 1 | I | 20 | 1 | 3 | 1 | 19 | 6 | 83 | 394 | 386 | 30.36 | 2.022012e+13 |
| 4 | I1 | 1 | 1 | I | 20 | 1 | 4 | 2 | 24 | 6 | 83 | 421 | 386 | 30.36 | 2.022012e+13 |
| 5 | I1 | 1 | 1 | I | 20 | 1 | 5 | 1 | 24 | 6 | 83 | 421 | 413 | 46.88 | 2.022012e+13 |
| 6 | I1 | 1 | 1 | I | 20 | 1 | 6 | 2 | 29 | 6 | 83 | 446 | 413 | 46.88 | 2.022012e+13 |
colnames(df)
dim(df)
rep(c(1:100),50) %>% sort() -> NumID
df<-cbind(df, NumID)
CPalet<-c("#117733","#6699CC","#CF6677")
show_col(CPalet)
CPalet
df %>%
group_by(NumID) %>%
summarise(Efficiency= mean(Fitness)) -> Efficiency
df1<-df[df$Trial==1,]
df1chosen<-df1[c("Generation","ExpCondition","ChainID", "Age", "Gender", "ID")]
cbind(
Efficiency,df1chosen) -> EfficiencyDf
EfficiencyDf
#head(Efficiency)
#cbind(Efficiency, PptGeneration,PptCondition, PptSessionID )
#cbind(Efficiency, PptGeneration,PptCondition, PptSessionID ) -> EfficiencyDf
#colnames(EfficiencyDf)<-c("ID","Efficiency","Generation","ExpCondition","SessionID")
#EfficiencyDf
| NumID | Efficiency | Generation | ExpCondition | ChainID | Age | Gender | ID | |
|---|---|---|---|---|---|---|---|---|
| <int> | <dbl> | <int> | <chr> | <int> | <int> | <int> | <chr> | |
| 1 | 1 | 673.64 | 1 | I | 1 | 20 | 1 | I1 |
| 51 | 2 | 574.44 | 1 | I | 2 | 20 | 3 | I2 |
| 101 | 3 | 690.86 | 1 | I | 3 | 21 | 3 | I3 |
| 151 | 4 | 646.92 | 1 | I | 4 | 20 | 3 | I4 |
| 201 | 5 | 548.62 | 1 | I | 5 | 20 | 2 | I5 |
| 251 | 6 | 604.26 | 1 | I | 6 | 19 | 2 | I6 |
| 301 | 7 | 696.34 | 1 | I | 7 | 20 | 3 | I7 |
| 351 | 8 | 746.52 | 1 | I | 8 | 20 | 3 | I8 |
| 401 | 9 | 710.72 | 1 | I | 9 | 21 | 3 | I9 |
| 451 | 10 | 750.20 | 1 | I | 10 | 21 | 3 | I10 |
| 501 | 11 | 677.64 | 1 | I | 11 | 21 | 3 | I11 |
| 551 | 12 | 707.82 | 1 | I | 12 | 21 | 2 | I12 |
| 601 | 13 | 680.68 | 1 | I | 13 | 21 | 2 | I13 |
| 651 | 14 | 708.72 | 1 | I | 14 | 19 | 3 | I14 |
| 701 | 15 | 736.90 | 1 | I | 15 | 21 | 3 | I15 |
| 751 | 16 | 727.50 | 1 | I | 16 | 21 | 3 | I16 |
| 801 | 17 | 689.64 | 1 | I | 17 | 20 | 2 | I17 |
| 851 | 18 | 704.38 | 1 | I | 18 | 19 | 3 | I18 |
| 901 | 19 | 677.84 | 1 | I | 19 | 19 | 3 | I19 |
| 951 | 20 | 628.82 | 1 | I | 20 | 20 | 2 | I20 |
| 1001 | 21 | 667.74 | 1 | O | 1 | 22 | 2 | O1 |
| 1051 | 22 | 898.20 | 2 | O | 1 | 20 | 3 | O1 |
| 1101 | 23 | 701.60 | 1 | O | 2 | 20 | 2 | O2 |
| 1151 | 24 | 935.46 | 2 | O | 2 | 19 | 3 | O2 |
| 1201 | 25 | 704.40 | 1 | O | 3 | 20 | 2 | O3 |
| 1251 | 26 | 937.44 | 2 | O | 3 | 22 | 2 | O3 |
| 1301 | 27 | 691.44 | 1 | O | 4 | 23 | 4 | O4 |
| 1351 | 28 | 830.04 | 2 | O | 4 | 22 | 2 | O4 |
| 1401 | 29 | 683.78 | 1 | O | 5 | 21 | 3 | O5 |
| 1451 | 30 | 881.56 | 2 | O | 5 | 21 | 3 | O5 |
| ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ |
| 3501 | 71 | 704.92 | 1 | V | 6 | 20 | 2 | V6 |
| 3551 | 72 | 792.34 | 2 | V | 6 | 22 | 3 | V6 |
| 3601 | 73 | 693.28 | 1 | V | 7 | 22 | 2 | V7 |
| 3651 | 74 | 867.82 | 2 | V | 7 | 20 | 2 | V7 |
| 3701 | 75 | 714.36 | 1 | V | 8 | 21 | 3 | V8 |
| 3751 | 76 | 952.12 | 2 | V | 8 | 21 | 2 | V8 |
| 3801 | 77 | 664.44 | 1 | V | 9 | 21 | 3 | V9 |
| 3851 | 78 | 793.00 | 2 | V | 9 | 21 | 3 | V9 |
| 3901 | 79 | 695.26 | 1 | V | 10 | 20 | 2 | V10 |
| 3951 | 80 | 848.44 | 2 | V | 10 | 22 | 3 | V10 |
| 4001 | 81 | 551.02 | 1 | V | 11 | 19 | 2 | V11 |
| 4051 | 82 | 694.70 | 2 | V | 11 | 18 | 2 | V11 |
| 4101 | 83 | 767.14 | 1 | V | 12 | 19 | 3 | V12 |
| 4151 | 84 | 934.86 | 2 | V | 12 | 20 | 2 | V12 |
| 4201 | 85 | 645.94 | 1 | V | 13 | 22 | 3 | V13 |
| 4251 | 86 | 936.38 | 2 | V | 13 | 19 | 3 | V13 |
| 4301 | 87 | 733.98 | 1 | V | 14 | 20 | 3 | V14 |
| 4351 | 88 | 914.00 | 2 | V | 14 | 19 | 3 | V14 |
| 4401 | 89 | 766.42 | 1 | V | 15 | 21 | 3 | V15 |
| 4451 | 90 | 975.00 | 2 | V | 15 | 19 | 3 | V15 |
| 4501 | 91 | 628.82 | 1 | V | 16 | 19 | 3 | V16 |
| 4551 | 92 | 934.64 | 2 | V | 16 | 20 | 3 | V16 |
| 4601 | 93 | 723.02 | 1 | V | 17 | 20 | 2 | V17 |
| 4651 | 94 | 967.10 | 2 | V | 17 | 20 | 3 | V17 |
| 4701 | 95 | 658.92 | 1 | V | 18 | 19 | 2 | V18 |
| 4751 | 96 | 880.12 | 2 | V | 18 | 19 | 2 | V18 |
| 4801 | 97 | 699.54 | 1 | V | 19 | 19 | 2 | V19 |
| 4851 | 98 | 901.94 | 2 | V | 19 | 19 | 2 | V19 |
| 4901 | 99 | 636.30 | 1 | V | 20 | 20 | 3 | V20 |
| 4951 | 100 | 825.40 | 2 | V | 20 | 22 | 2 | V20 |
EfficiencyDf$Generation - EfficiencyDf$Generation_backup
df %>%
group_by(NumID) %>%
summarise(sum_choice = sum(Choice-1)) -> Exploration
df1<-df[df$Trial==1,]
PSessionID<-df1$ChainID
PGeneration<-df1$Generation
PCondition<-df1$ExpCondition
PGender<-df1$Gender
cbind(Exploration, PGeneration,PCondition, PSessionID, PGender) -> ExpDf
colnames(ExpDf)<-c("ID","Exploration","Generation","ExpCondition","SessionID","Gender")
head(ExpDf)
| ID | Exploration | Generation | ExpCondition | SessionID | Gender | |
|---|---|---|---|---|---|---|
| <int> | <dbl> | <int> | <chr> | <int> | <int> | |
| 1 | 1 | 18 | 1 | I | 1 | 1 |
| 2 | 2 | 17 | 1 | I | 2 | 3 |
| 3 | 3 | 21 | 1 | I | 3 | 3 |
| 4 | 4 | 22 | 1 | I | 4 | 3 |
| 5 | 5 | 19 | 1 | I | 5 | 2 |
| 6 | 6 | 24 | 1 | I | 6 | 2 |
library(extrafont)
labeli <- as_labeller(c("I" = "Asocial",
"O" = "Unrepaid",
"V" = "Repaid",
"1"="1","2"="2","3"="3","4"="4","5"="5","6"="6","7"="7","8"="8","9"="9","10"="10","11"="11",
"12"="12","13"="13","14"="14",
"15"="15","16"="16","17"="17","18"="18","19"="19","20"="20"))
#my_x_title <- expression(paste("Trial (", italic("T"), ")"))
my_x_title <- "Trial"
options(repr.plot.width=10, repr.plot.height=5.2)
#options(repr.plot.width=20, repr.plot.height=20)
g<-ggplot(df[df$Generation == 1, ], aes(x=Trial, y= Choice-1, color = as.factor(ExpCondition))) +
ylim(0,1)+
theme_bw()+geom_point()+geom_line(alpha = 1, size = 0.2)+facet_grid(as.factor(ChainID)~ExpCondition ,labeller = labeli)+
theme(axis.title.y=element_blank(),
axis.text.y=element_blank(),
axis.ticks.y=element_blank(),
panel.grid.major.y = element_blank(),
panel.grid.minor.y = element_blank()
)+ xlab(my_x_title)+
theme(legend.position = "none")+
scale_color_manual(values = CPalet)
g
ggsave("FiguresRev/FigExplExpr.pdf", dpi = 220, device = "pdf", width = 10, height = 5.2)
ggsave("FiguresRev/FigExplExpr.eps", dpi = 220, device = "eps", width = 10, height = 5.2)
ggsave("FiguresRev/FigExplExpr.png", dpi = 220, device = "png", width = 10, height = 5.2)
DF<-ExpDf[,c(1,2,3,4)]
head(DF)
DF %>%
group_by(Generation, ExpCondition) %>%
summarise(mean = mean(Exploration), SE = sd(Exploration)/sqrt(20)) -> SmrDF
SmrDF$SE %>% round(.,3) -> SmrDF$SE
| ID | Exploration | Generation | ExpCondition | |
|---|---|---|---|---|
| <int> | <dbl> | <int> | <chr> | |
| 1 | 1 | 18 | 1 | I |
| 2 | 2 | 17 | 1 | I |
| 3 | 3 | 21 | 1 | I |
| 4 | 4 | 22 | 1 | I |
| 5 | 5 | 19 | 1 | I |
| 6 | 6 | 24 | 1 | I |
`summarise()` has grouped output by 'Generation'. You can override using the `.groups` argument.
#DF[(DF$Generation == 1)&(DF$ExpCondition== "I"),]$Exploration
DF[(DF$Generation == 1)&(DF$ExpCondition== "I"),]$Exploration %>% rank(., ties.method= "first") -> orderI1
orderI1<-length(orderI1)+1-orderI1
DF[(DF$Generation == 2)&(DF$ExpCondition== "I"),]$Exploration %>% rank(., ties.method= "first") -> orderI2
orderI2<-length(orderI2)+1-orderI2
#DF[(DF$Generation == 1)&(DF$ExpCondition== "O"),]$Exploration
DF[(DF$Generation == 1)&(DF$ExpCondition== "O"),]$Exploration %>% rank(., ties.method= "first") -> orderO1
orderO1<-length(orderO1)+1-orderO1
DF[(DF$Generation == 2)&(DF$ExpCondition== "O"),]$Exploration %>% rank(., ties.method= "first") -> orderO2
orderO2<-length(orderO2)+1-orderO2
#DF[(DF$Generation == 1)&(DF$ExpCondition== "V"),]$Exploration
DF[(DF$Generation == 1)&(DF$ExpCondition== "V"),]$Exploration %>% rank(., ties.method= "first") -> orderV1
orderV1<-length(orderV1)+1-orderV1
DF[(DF$Generation == 2)&(DF$ExpCondition== "V"),]$Exploration %>% rank(., ties.method= "first")-> orderV2
orderV2<-length(orderV2)+1-orderV2
Order<-df$ChainID
df<-mutate(df, Order)
df[(df$Generation == 1)&(df$ExpCondition== "I"),]$ChainID -> tempIDList
df[(df$Generation == 1)&(df$ExpCondition== "I"),]$Order<-orderI1[tempIDList]
df[(df$Generation == 2)&(df$ExpCondition== "I"),]$ChainID -> tempIDList
df[(df$Generation == 2)&(df$ExpCondition== "I"),]$Order<-orderI2[tempIDList]
df[(df$Generation == 1)&(df$ExpCondition== "O"),]$ChainID -> tempIDList
df[(df$Generation == 1)&(df$ExpCondition== "O"),]$Order<-orderO1[tempIDList]
df[(df$Generation == 2)&(df$ExpCondition== "O"),]$ChainID -> tempIDList
df[(df$Generation == 2)&(df$ExpCondition== "O"),]$Order<-orderO2[tempIDList]
df[(df$Generation == 1)&(df$ExpCondition== "V"),]$ChainID -> tempIDList
df[(df$Generation == 1)&(df$ExpCondition== "V"),]$Order<-orderV1[tempIDList]
df[(df$Generation == 2)&(df$ExpCondition== "V"),]$ChainID -> tempIDList
df[(df$Generation == 2)&(df$ExpCondition== "V"),]$Order<-orderV2[tempIDList]
tempIDList[orderV1] %>% length()
df[(df$Generation == 2)&(df$ExpCondition== "V"),]$Order %>% length()
labeli <- as_labeller(c("I" = "Asocial",
"O" = "Unrepaid",
"V" = "Repaid",
"1"="1","2"="2","3"="3","4"="4","5"="5","6"="6","7"="7","8"="8","9"="9","10"="10","11"="11",
"12"="12","13"="13","14"="14",
"15"="15","16"="16","17"="17","18"="18","19"="19","20"="20"))
my_x_title <- expression("Trial")
options(repr.plot.width=10, repr.plot.height=5.2)
#options(repr.plot.width=20, repr.plot.height=20)
g<-ggplot(df[df$Generation == 1, ], aes(x=Trial, y= Choice-1, color = as.factor(ExpCondition))) +
ylim(0,1)+
theme_bw()+geom_point()+geom_line(alpha = 1, size = 0.2)+facet_grid(as.factor(Order)~ExpCondition ,labeller = labeli)+
theme(axis.title.y=element_blank(),
axis.text.y=element_blank(),
axis.ticks.y=element_blank(),
panel.grid.major.y = element_blank(),
panel.grid.minor.y = element_blank()
)+ xlab(my_x_title)+
theme(legend.position = "none")+
scale_color_manual(values = CPalet)
g
ggsave("FiguresRev/FigExplExpr.pdf", dpi = 220, device = "pdf", width = 10, height = 5.2)
ggsave("FiguresRev/FigExplExpr.eps", dpi = 220, device = "eps", width = 10, height = 5.2)
ggsave("FiguresRev/FigExplExpr.png", dpi = 220, device = "png", width = 10, height = 5.2)
DF<-ExpDf[,c(1,2,3,4)]
head(DF)
DF %>%
group_by(Generation, ExpCondition) %>%
summarise(mean = mean(Exploration), SE = sd(Exploration)/sqrt(20)) -> SmrDF
SmrDF$SE %>% round(.,3) -> SmrDF$SE
SmrDF
| ID | Exploration | Generation | ExpCondition | |
|---|---|---|---|---|
| <int> | <dbl> | <int> | <chr> | |
| 1 | 1 | 18 | 1 | I |
| 2 | 2 | 17 | 1 | I |
| 3 | 3 | 21 | 1 | I |
| 4 | 4 | 22 | 1 | I |
| 5 | 5 | 19 | 1 | I |
| 6 | 6 | 24 | 1 | I |
`summarise()` has grouped output by 'Generation'. You can override using the `.groups` argument.
| Generation | ExpCondition | mean | SE |
|---|---|---|---|
| <int> | <chr> | <dbl> | <dbl> |
| 1 | I | 20.10 | 0.784 |
| 1 | O | 19.45 | 1.243 |
| 1 | V | 24.60 | 1.437 |
| 2 | O | 11.15 | 1.190 |
| 2 | V | 10.65 | 1.575 |
#ExpDf[(ExpDf$Generation == 1)&(ExpDf$ExpCondition!= "O"),] -> JASPVI
#ExpDf[(ExpDf$Generation == 1)&(ExpDf$ExpCondition!= "V"),] -> JASPOI
#write.csv(JASPVI, file="JASPVI.csv", sep=",")
#write.csv(JASPOI, file="JASPOI.csv", sep=",")
y_title <- expression(paste("Exploration trials (", italic(tau), ")"))
#taulabel<-"a"
taulabel<- expression(italic(tau)*"*")
options(repr.plot.width=6, repr.plot.height=3)
suppressMessages(
suppressWarnings(
g <- ggplot(ExpDf[ExpDf$Generation ==1,], aes(x =as.factor(ExpCondition), y = Exploration,fill =as.factor(ExpCondition))) +
ggdist::stat_slab( aes(x =as.numeric(as.factor(ExpCondition))+0.1),
alpha = 0.9,
width = .24,
.width = c(0.00002, .92),
) +
geom_jitter(size = 0.7,height=0, width =0.05, alpha = 0.7,aes(x = as.factor(ExpCondition), color =as.factor(ExpCondition))) +
coord_cartesian(xlim = c(1.0, NA))+theme_bw()+
scale_color_manual(values = CPalet, name = "Condition",labels = c("Asocial", "Unrepaid","Repaid"))+
scale_fill_manual(values = CPalet, name = "Condition",labels = c("Asocial", "Unrepaid","Repaid"))+
ylab(y_title )+xlab("Experimental Conition")+
scale_x_discrete("Condition", labels = c("I" = "Asocial","O" = "Unrepaid", "V" = "Repaid"))+
stat_summary(fun= mean, geom="bar", alpha = 1, width = 0.2, color = "black",aes(x = as.numeric(as.factor(ExpCondition))-0.2)) +
stat_summary(fun.min = function(x) mean(x) -sd(x)/sqrt(length(x)),
fun.max = function(x) mean(x) + sd(x)/sqrt(length(x)),
geom = "errorbar", width =0.05, aes(x = as.numeric(as.factor(ExpCondition))-0.2))+
geom_segment(aes(x=0.6,xend=1.22,y=(Generation-1)*12,yend=(Generation-1)*12),linetype=2, color = "grey39", size = 0.4)+
geom_segment(aes(x=1.6,xend=2.22,y=(Generation-1)*12,yend=(Generation-1)*12),linetype=2, color = "grey39", size = 0.4)+
geom_segment(aes(x=2.6,xend=3.22,y=(Generation-1)*22,yend=(Generation-1)*22),linetype=2, color = "grey39", size = 0.4)+
annotate("text",x=1.3,y=0.01+12,label=taulabel) +
annotate("text",x=2.3,y=0.01+12,label=taulabel) +
annotate("text",x=3.3,y=0.01+22,label=taulabel)
))
suppressMessages(
suppressWarnings(g)
)
ggsave("Figures/MFreqExpo.pdf", dpi = 220, device = "pdf", width = 5, height =3)
Warning message in is.na(x): “ is.na() は型 'expression' のベクトル、リスト以外に適用されます ” Warning message in is.na(x): “ is.na() は型 'expression' のベクトル、リスト以外に適用されます ” Warning message in is.na(x): “ is.na() は型 'expression' のベクトル、リスト以外に適用されます ” Warning message in is.na(x): “ is.na() は型 'expression' のベクトル、リスト以外に適用されます ” Warning message in is.na(x): “ is.na() は型 'expression' のベクトル、リスト以外に適用されます ” Warning message in is.na(x): “ is.na() は型 'expression' のベクトル、リスト以外に適用されます ”
y_title <- expression(paste("Mean exploration rate (", italic("W/T"), ")"))
labeli <- as_labeller(c("I" = "Asocial",
"O" = "Unnrepaid",
"V" = "Repaid",
"1"="First Generation","2"="Second Generation"))
options(repr.plot.width=5, repr.plot.height=3)
ggplot(SmrDF, aes(y=mean, x=ExpCondition,fill=ExpCondition))+
geom_bar(stat = "identity", width = 0.4 , color = "black")+theme_bw()+
geom_errorbar(aes(ymax = mean + SE, ymin = mean - SE), width = 0.1)+
facet_grid(Generation~., labeller = labeli )+
scale_fill_manual(values = CPalet, name = "Condition",labels = c("Asocial", "Unrepaid","Repaid"))+
ylab(y_title )+xlab("Experimental Conition")+
scale_x_discrete("Condition", labels = c("I" = "Asocial","O" = "Unrepaid", "V" = "Repaid"))
#ggsave("MExpRate.pdf", dpi = 220, device = "pdf", width = 5, height =3)
y_title <- expression(paste("Exploration trials (", italic(tau), ")"))
#taulabel<-"a"
taulabel<- expression(italic(tau)*"*")
options(repr.plot.width=6, repr.plot.height=3)
suppressMessages(
suppressWarnings(
g <- ggplot(ExpDf[ExpDf$Generation ==1,], aes(x =as.factor(ExpCondition), y = Exploration,fill =as.factor(ExpCondition))) +
ggdist::stat_slab( aes(x =as.numeric(as.factor(ExpCondition))+0.1),
alpha = 0.9,
width = .24,
.width = c(0.00002, .92),
) +
geom_jitter(size = 0.7,height=0, width =0.05, alpha = 0.7,aes(x = as.factor(ExpCondition), color =as.factor(ExpCondition))) +
coord_cartesian(xlim = c(1.0, NA))+theme_bw()+
scale_color_manual(values = CPalet, name = "Condition",labels = c("Asocial", "Unrepaid","Repaid"))+
scale_fill_manual(values = CPalet, name = "Condition",labels = c("Asocial", "Unrepaid","Repaid"))+
ylab(y_title )+xlab("Experimental Conition")+
scale_x_discrete("Condition", labels = c("I" = "Asocial","O" = "Unrepaid", "V" = "Repaid"))+
#stat_summary(fun= mean, geom="bar", alpha = 1, width = 0.2, color = "black",aes(x = as.numeric(as.factor(ExpCondition))-0.2)) +
geom_boxplot(alpha=0.7, width =0.2, aes(x = as.numeric(as.factor(ExpCondition))-0.2))+
geom_segment(aes(x=0.6,xend=1.22,y=12,yend=12),linetype=2, color = "grey39", size = 0.4)+
geom_segment(aes(x=1.6,xend=2.22,y=12,yend=12),linetype=2, color = "grey39", size = 0.4)+
geom_segment(aes(x=2.6,xend=3.22,y=22,yend=22),linetype=2, color = "grey39", size = 0.4)+
stat_summary(fun= mean, geom="point", size = 2.5, shape = 18 ,alpha = 1, width = 0.2, color = "black",aes(x = as.numeric(as.factor(ExpCondition))-0.2)) +
stat_summary(fun.min = function(x) mean(x) -sd(x)/sqrt(length(x)),
fun.max = function(x) mean(x) + sd(x)/sqrt(length(x)),
geom = "errorbar", width =0.05, aes(x = as.numeric(as.factor(ExpCondition))-0.2))+
annotate("text",x=1.3,y=0.01+12,label=taulabel) +
annotate("text",x=2.3,y=0.01+12,label=taulabel) +
annotate("text",x=3.3,y=0.01+22,label=taulabel)
))
suppressMessages(
suppressWarnings(g)
)
ggsave("Figures/MFreqExpoR1.pdf", dpi = 220, device = "pdf", width = 5, height =3)
ggsave("Figures/MFreqExpoR1.png", dpi = 220, device = "png", width = 5, height =3)
Warning message in is.na(x): “ is.na() は型 'expression' のベクトル、リスト以外に適用されます ” Warning message in is.na(x): “ is.na() は型 'expression' のベクトル、リスト以外に適用されます ” Warning message in is.na(x): “ is.na() は型 'expression' のベクトル、リスト以外に適用されます ” Warning message in is.na(x): “ is.na() は型 'expression' のベクトル、リスト以外に適用されます ” Warning message in is.na(x): “ is.na() は型 'expression' のベクトル、リスト以外に適用されます ” Warning message in is.na(x): “ is.na() は型 'expression' のベクトル、リスト以外に適用されます ” Warning message in is.na(x): “ is.na() は型 'expression' のベクトル、リスト以外に適用されます ” Warning message in is.na(x): “ is.na() は型 'expression' のベクトル、リスト以外に適用されます ” Warning message in is.na(x): “ is.na() は型 'expression' のベクトル、リスト以外に適用されます ”
y_title <- expression(paste("Exploration trials (", italic(tau), ")"))
#taulabel<-"a"
taulabel<- expression(italic(tau)*"*")
options(repr.plot.width=6, repr.plot.height=3)
suppressMessages(
suppressWarnings(
g <- ggplot(ExpDf[ExpDf$Generation ==1,], aes(x =as.factor(ExpCondition), y = Exploration,fill =as.factor(ExpCondition))) +
ggdist::stat_slab( aes(x =as.numeric(as.factor(ExpCondition))+0.1),
alpha = 0.9,
width = .24,
.width = c(0.00002, .92),
) +
geom_jitter(size = 0.7,height=0, width =0.05, alpha = 0.7,aes(x = as.factor(ExpCondition), color =as.factor(ExpCondition))) +
coord_cartesian(xlim = c(1.0, NA))+theme_bw()+
scale_color_manual(values = CPalet, name = "Condition",labels = c("Asocial", "Unrepaid","Repaid"))+
scale_fill_manual(values = CPalet, name = "Condition",labels = c("Asocial", "Unrepaid","Repaid"))+
ylab(y_title )+xlab("Experimental Conition")+
scale_x_discrete("Condition", labels = c("I" = "Asocial","O" = "Unrepaid", "V" = "Repaid"))+
#stat_summary(fun= mean, geom="bar", alpha = 1, width = 0.2, color = "black",aes(x = as.numeric(as.factor(ExpCondition))-0.2)) +
geom_boxplot(alpha=0.7, width =0.2, aes(x = as.numeric(as.factor(ExpCondition))-0.2))+
geom_segment(aes(x=0.6,xend=1.22,y=12,yend=12),linetype=2, color = "grey39", size = 0.4)+
geom_segment(aes(x=1.6,xend=2.22,y=12,yend=12),linetype=2, color = "grey39", size = 0.4)+
geom_segment(aes(x=2.6,xend=3.22,y=22,yend=22),linetype=2, color = "grey39", size = 0.4)+
geom_segment(aes(x=1,xend=3,y=43,yend=43),linetype=1, color = "grey39", size = 0.2)+
geom_segment(aes(x=1,xend=1,y=41,yend=43),linetype=1, color = "grey39", size = 0.2)+
geom_segment(aes(x=3,xend=3,y=41,yend=43),linetype=1, color = "grey39", size = 0.2)+
geom_segment(aes(x=1,xend=2,y=33,yend=33),linetype=1, color = "grey39", size = 0.2)+
geom_segment(aes(x=1,xend=1,y=31,yend=33),linetype=1, color = "grey39", size = 0.2)+
geom_segment(aes(x=2,xend=2,y=31,yend=33),linetype=1, color = "grey39", size = 0.2)+
stat_summary(fun= mean, geom="point", size = 2.5, shape = 18 ,alpha = 1, width = 0.2, color = "black",aes(x = as.numeric(as.factor(ExpCondition))-0.2)) +
stat_summary(fun.min = function(x) mean(x) -sd(x)/sqrt(length(x)),
fun.max = function(x) mean(x) + sd(x)/sqrt(length(x)),
geom = "errorbar", width =0.05, aes(x = as.numeric(as.factor(ExpCondition))-0.2))+
annotate("text",x=1.3,y=0.01+12,label=taulabel) +
annotate("text",x=2.3,y=0.01+12,label=taulabel) +
annotate("text",x=3.3,y=0.01+22,label=taulabel) +
annotate("text",x=2,y=45,label="* (p = 0.010)") +
annotate("text",x=1.5,y=34.5,label="NS (p = 0.661)")
))
suppressMessages(
suppressWarnings(g)
)
ggsave("Figures/MFreqExpoR1_sig.pdf", dpi = 220, device = "pdf", width = 5, height =3)
ggsave("Figures/MFreqExpoR1_sig.png", dpi = 220, device = "png", width = 5, height =3)
Warning message in is.na(x): “ is.na() は型 'expression' のベクトル、リスト以外に適用されます ” Warning message in is.na(x): “ is.na() は型 'expression' のベクトル、リスト以外に適用されます ” Warning message in is.na(x): “ is.na() は型 'expression' のベクトル、リスト以外に適用されます ” Warning message in is.na(x): “ is.na() は型 'expression' のベクトル、リスト以外に適用されます ” Warning message in is.na(x): “ is.na() は型 'expression' のベクトル、リスト以外に適用されます ” Warning message in is.na(x): “ is.na() は型 'expression' のベクトル、リスト以外に適用されます ” Warning message in is.na(x): “ is.na() は型 'expression' のベクトル、リスト以外に適用されます ” Warning message in is.na(x): “ is.na() は型 'expression' のベクトル、リスト以外に適用されます ” Warning message in is.na(x): “ is.na() は型 'expression' のベクトル、リスト以外に適用されます ”
extrafont::loadfonts()
y_title <- expression(paste("Exploration trials (", italic(tau), ")"))
#taulabel<-"a"
taulabel<- expression(italic(tau)*"*")
options(repr.plot.width=6, repr.plot.height=3)
suppressMessages(
suppressWarnings(
g <- ggplot(ExpDf[ExpDf$Generation ==1,], aes(x =as.factor(ExpCondition), y = Exploration,fill =as.factor(ExpCondition))) +
ggdist::stat_slab( aes(x =as.numeric(as.factor(ExpCondition))+0.1),
alpha = 0.9,
width = .24,
.width = c(0.00002, .92),
) +
geom_jitter(size = 0.7,height=0, width =0.05, alpha = 0.7,aes(x = as.factor(ExpCondition), color =as.factor(ExpCondition))) +
coord_cartesian(xlim = c(1.0, NA))+theme_bw()+
scale_color_manual(values = CPalet, name = "Condition",labels = c("Asocial", "Unrepaid","Repaid"))+
scale_fill_manual(values = CPalet, name = "Condition",labels = c("Asocial", "Unrepaid","Repaid"))+
ylab(y_title )+xlab("Experimental Conition")+
scale_x_discrete("Condition", labels = c("I" = "Asocial","O" = "Unrepaid", "V" = "Repaid"))+
#stat_summary(fun= mean, geom="bar", alpha = 1, width = 0.2, color = "black",aes(x = as.numeric(as.factor(ExpCondition))-0.2)) +
geom_boxplot(alpha=0.7, width =0.2, aes(x = as.numeric(as.factor(ExpCondition))-0.2))+
geom_segment(aes(x=0.6,xend=1.22,y=12,yend=12),linetype=2, color = "grey39", size = 0.4)+
geom_segment(aes(x=1.6,xend=2.22,y=12,yend=12),linetype=2, color = "grey39", size = 0.4)+
geom_segment(aes(x=2.6,xend=3.22,y=22,yend=22),linetype=2, color = "grey39", size = 0.4)+
geom_segment(aes(x=1,xend=3,y=43,yend=43),linetype=1, color = "grey39", size = 0.2)+
geom_segment(aes(x=1,xend=1,y=41,yend=43),linetype=1, color = "grey39", size = 0.2)+
geom_segment(aes(x=3,xend=3,y=41,yend=43),linetype=1, color = "grey39", size = 0.2)+
geom_segment(aes(x=1,xend=2,y=33,yend=33),linetype=1, color = "grey39", size = 0.2)+
geom_segment(aes(x=1,xend=1,y=31,yend=33),linetype=1, color = "grey39", size = 0.2)+
geom_segment(aes(x=2,xend=2,y=31,yend=33),linetype=1, color = "grey39", size = 0.2)+
stat_summary(fun= mean, geom="point", size = 2.5, shape = 18 ,alpha = 1, width = 0.2, color = "black",aes(x = as.numeric(as.factor(ExpCondition))-0.2)) +
stat_summary(fun.min = function(x) mean(x) -sd(x)/sqrt(length(x)),
fun.max = function(x) mean(x) + sd(x)/sqrt(length(x)),
geom = "errorbar", width =0.05, aes(x = as.numeric(as.factor(ExpCondition))-0.2))+
annotate("text",x=1.3,y=0.01+12,label=taulabel) +
annotate("text",x=2.3,y=0.01+12,label=taulabel) +
annotate("text",x=3.3,y=0.01+22,label=taulabel) +
annotate("text",x=2,y=43,label="*", size = 5) +
annotate("text",family = "Helvetica",x=1.5,y=34.5,label="NS", size = 2.5)
))
suppressMessages(
suppressWarnings(g)
)
ggsave("Figures/MFreqExpoR1_sig1.pdf", dpi = 220, device = "pdf", width = 5, height =3)
ggsave("Figures/MFreqExpoR1_sig1.png", dpi = 220, device = "png", width = 5, height =3)
Warning message in is.na(x): “ is.na() は型 'expression' のベクトル、リスト以外に適用されます ” Warning message in is.na(x): “ is.na() は型 'expression' のベクトル、リスト以外に適用されます ” Warning message in is.na(x): “ is.na() は型 'expression' のベクトル、リスト以外に適用されます ” Warning message in is.na(x): “ is.na() は型 'expression' のベクトル、リスト以外に適用されます ” Warning message in is.na(x): “ is.na() は型 'expression' のベクトル、リスト以外に適用されます ” Warning message in is.na(x): “ is.na() は型 'expression' のベクトル、リスト以外に適用されます ” Warning message in is.na(x): “ is.na() は型 'expression' のベクトル、リスト以外に適用されます ” Warning message in is.na(x): “ is.na() は型 'expression' のベクトル、リスト以外に適用されます ” Warning message in is.na(x): “ is.na() は型 'expression' のベクトル、リスト以外に適用されます ”
y_title <- expression(paste("Exploration trials (", italic(tau), ")"))
#taulabel<-"a"
taulabel<- expression(italic(tau)*"*")
options(repr.plot.width=6, repr.plot.height=6)
suppressMessages(
suppressWarnings(
g <- ggplot(ExpDf, aes(x =as.factor(ExpCondition), y = Exploration,fill =as.factor(ExpCondition))) +
ggdist::stat_slab( aes(x =as.numeric(as.factor(ExpCondition))+0.1),
alpha = 0.9,
width = .24,
.width = c(0.00002, .92),
) +
geom_jitter(size = 0.7,height=0, width =0.05, alpha = 0.7,aes(x = as.factor(ExpCondition), color =as.factor(ExpCondition))) +
coord_cartesian(xlim = c(1.0, NA))+theme_bw()+
scale_color_manual(values = CPalet, name = "Condition",labels = c("Asocial", "Unrepaid","Repaid"))+
scale_fill_manual(values = CPalet, name = "Condition",labels = c("Asocial", "Unrepaid","Repaid"))+
ylab(y_title )+xlab("Experimental Conition")+
scale_x_discrete("Condition", labels = c("I" = "Asocial","O" = "Unrepaid", "V" = "Repaid"))+
#stat_summary(fun= mean, geom="bar", alpha = 1, width = 0.2, color = "black",aes(x = as.numeric(as.factor(ExpCondition))-0.2)) +
geom_boxplot(alpha=0.7, width =0.2, aes(x = as.numeric(as.factor(ExpCondition))-0.2))+
# geom_segment(aes(x=0.6,xend=1.22,y=12,yend=12),linetype=2, color = "grey39", size = 0.4)+
# geom_segment(aes(x=1.6,xend=2.22,y=12,yend=12),linetype=2, color = "grey39", size = 0.4)+
# geom_segment(aes(x=2.6,xend=3.22,y=22,yend=22),linetype=2, color = "grey39", size = 0.4)+
stat_summary(fun= mean, geom="point", size = 3, shape = 18 , alpha = 1, width = 0.2, color = "black",aes(x = as.numeric(as.factor(ExpCondition))-0.2)) +
stat_summary(fun.min = function(x) mean(x) -sd(x)/sqrt(length(x)),
fun.max = function(x) mean(x) + sd(x)/sqrt(length(x)),
geom = "errorbar", width =0.05, aes(x = as.numeric(as.factor(ExpCondition))-0.2))+
facet_grid(Generation~., labeller = labeli )
#+
#annotate("text",x=1.3,y=0.01+12,label=taulabel) +
#annotate("text",x=2.3,y=0.01+12,label=taulabel) +
#annotate("text",x=3.3,y=0.01+22,label=taulabel)
))
suppressMessages(
suppressWarnings(g)
)
ggsave("Figures/MFreqExpo2Gen.png", dpi = 220, device = "png", width = 5, height =3)
ggsave("Figures/MFreqExpo2Gen.pdf", dpi = 220, device = "pdf", width = 5, height =3)
y_title <- expression(paste("Exploration trials (", italic(tau), ")"))
#taulabel<-"a"
taulabel<- expression(italic(tau)*"*")
options(repr.plot.width=6.5, repr.plot.height=3)
suppressMessages(
suppressWarnings(
g <- ggplot(ExpDf, aes(x =as.factor(ExpCondition), y = Exploration,fill =as.factor(ExpCondition))) +
ggdist::stat_slab( aes(x =as.numeric(as.factor(ExpCondition))+0.1),
alpha = 0.9,
width = .24,
.width = c(0.00002, .92),
) +
geom_jitter(size = 0.7,height=0, width =0.05, alpha = 0.7,aes(x = as.factor(ExpCondition), color =as.factor(ExpCondition))) +
coord_cartesian(xlim = c(1.0, NA))+theme_bw()+
scale_color_manual(values = CPalet, name = "Condition",labels = c("Asocial", "Unrepaid","Repaid"))+
scale_fill_manual(values = CPalet, name = "Condition",labels = c("Asocial", "Unrepaid","Repaid"))+
ylab(y_title )+xlab("Experimental Conition")+
scale_x_discrete("Condition", labels = c("I" = "Asocial","O" = "Unrepaid", "V" = "Repaid"))+
#stat_summary(fun= mean, geom="bar", alpha = 1, width = 0.2, color = "black",aes(x = as.numeric(as.factor(ExpCondition))-0.2)) +
geom_boxplot(alpha=0.7, width =0.2, aes(x = as.numeric(as.factor(ExpCondition))-0.2))+
geom_segment(aes(x=0.6,xend=1.22,y=(-1*Generation+2)*12,yend=(-1*Generation+2)*12),linetype=2, color = "grey39", size = 0.4)+
geom_segment(aes(x=1.6,xend=2.22,y=(-1*Generation+2)*12,yend=(-1*Generation+2)*12),linetype=2, color = "grey39", size = 0.4)+
geom_segment(aes(x=2.6,xend=3.22,y=(-1*Generation+2)*22,yend=(-1*Generation+2)*22),linetype=2, color = "grey39", size = 0.4)+
stat_summary(fun= mean, geom="point", size = 3, shape = 18 , alpha = 1, width = 0.2, color = "black",aes(x = as.numeric(as.factor(ExpCondition))-0.2)) +
stat_summary(fun.min = function(x) mean(x) -sd(x)/sqrt(length(x)),
fun.max = function(x) mean(x) + sd(x)/sqrt(length(x)),
geom = "errorbar", width =0.05, aes(x = as.numeric(as.factor(ExpCondition))-0.2))+
#annotate("text",x=1.3,y=0.01+(-1*Generation+2)*12,label=taulabel) +
#annotate("text",x=2.3,y=0.01+(-1*Generation+2)*12,label=taulabel) +
#annotate("text",x=3.3,y=0.01+(-1*Generation+2)*22,label=taulabel) +
facet_grid(.~Generation, labeller = labeli )
#+
#annotate("text",x=1.3,y=0.01+12,label=taulabel) +
#annotate("text",x=2.3,y=0.01+12,label=taulabel) +
#annotate("text",x=3.3,y=0.01+22,label=taulabel)
))
suppressMessages(
suppressWarnings(g)
)
ggsave("Figures/MFreqExpo2Gen.png", dpi = 220, device = "png", width = 6.5, height =3)
ggsave("Figures/MFreqExpo2Gen.pdf", dpi = 220, device = "pdf", width = 6.5, height =3)
y_title <- expression(paste("Exploration trials (", italic(tau), ")"))
#taulabel<-"a"
taulabel<- expression(italic(tau)*"*")
options(repr.plot.width=9, repr.plot.height=3)
suppressMessages(
suppressWarnings(
g <- ggplot(ExpDf, aes(x =as.factor(ExpCondition), y = Exploration,fill =as.factor(ExpCondition))) +
ggdist::stat_slab( aes(x =as.numeric(as.factor(ExpCondition))+0.1),
alpha = 0.9,
width = .24,
.width = c(0.00002, .92),
) +
geom_jitter(size = 0.7,height=0, width =0.05, alpha = 0.7,aes(x = as.factor(ExpCondition), color =as.factor(ExpCondition))) +
coord_cartesian(xlim = c(1.0, NA))+theme_bw()+
scale_color_manual(values = CPalet, name = "Condition",labels = c("Asocial", "Unrepaid","Repaid"))+
scale_fill_manual(values = CPalet, name = "Condition",labels = c("Asocial", "Unrepaid","Repaid"))+
ylab(y_title)+xlab("Experimental Conition")+
scale_x_discrete("Condition", labels = c("I" = "Asocial","O" = "Unrepaid", "V" = "Repaid"))+
#stat_summary(fun= mean, geom="bar", alpha = 1, width = 0.2, color = "black",aes(x = as.numeric(as.factor(ExpCondition))-0.2)) +
geom_boxplot(alpha=0.7, width =0.2, aes(x = as.numeric(as.factor(ExpCondition))-0.2))+
# geom_segment(aes(x=0.6,xend=1.22,y=12,yend=12),linetype=2, color = "grey39", size = 0.4)+
# geom_segment(aes(x=1.6,xend=2.22,y=12,yend=12),linetype=2, color = "grey39", size = 0.4)+
# geom_segment(aes(x=2.6,xend=3.22,y=22,yend=22),linetype=2, color = "grey39", size = 0.4)+
stat_summary(fun= mean, geom="point", size = 3, shape = 18 , alpha = 1, width = 0.2, color = "black",aes(x = as.numeric(as.factor(ExpCondition))-0.2)) +
stat_summary(fun.min = function(x) mean(x) -sd(x)/sqrt(length(x)),
fun.max = function(x) mean(x) + sd(x)/sqrt(length(x)),
geom = "errorbar", width =0.05, aes(x = as.numeric(as.factor(ExpCondition))-0.2))+
facet_grid(.~Generation, labeller = labeli )
#+
#annotate("text",x=1.3,y=0.01+12,label=taulabel) +
#annotate("text",x=2.3,y=0.01+12,label=taulabel) +
#annotate("text",x=3.3,y=0.01+22,label=taulabel)
))
suppressMessages(
suppressWarnings(g)
)
ggsave("Figures/MFreqExpo2Gen.png", dpi = 220, device = "png", width = 6.5, height =3)
ggsave("Figures/MFreqExpo2Gen.pdf", dpi = 220, device = "pdf", width = 6.5, height =3)
"IND"
ExpDf[(ExpDf$Generation == 1)&(ExpDf$ExpCondition == "I"),]$Exploration -> IND_Expo
round(psych::describe( IND_Expo),2)
"OBL"
ExpDf[(ExpDf$Generation == 1)&(ExpDf$ExpCondition == "O"),]$Exploration -> OBL_Expo
round(psych::describe( OBL_Expo),2)
"VER"
ExpDf[(ExpDf$Generation == 1)&(ExpDf$ExpCondition == "V"),]$Exploration -> VER_Expo
round(psych::describe( VER_Expo),2)
| vars | n | mean | sd | median | trimmed | mad | min | max | range | skew | kurtosis | se | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| <dbl> | <dbl> | <dbl> | <dbl> | <dbl> | <dbl> | <dbl> | <dbl> | <dbl> | <dbl> | <dbl> | <dbl> | <dbl> | |
| X1 | 1 | 20 | 20.1 | 3.51 | 19 | 20 | 3.71 | 15 | 27 | 12 | 0.34 | -1.11 | 0.78 |
| vars | n | mean | sd | median | trimmed | mad | min | max | range | skew | kurtosis | se | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| <dbl> | <dbl> | <dbl> | <dbl> | <dbl> | <dbl> | <dbl> | <dbl> | <dbl> | <dbl> | <dbl> | <dbl> | <dbl> | |
| X1 | 1 | 20 | 19.45 | 5.56 | 20 | 19.81 | 5.93 | 8 | 27 | 19 | -0.41 | -0.99 | 1.24 |
| vars | n | mean | sd | median | trimmed | mad | min | max | range | skew | kurtosis | se | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| <dbl> | <dbl> | <dbl> | <dbl> | <dbl> | <dbl> | <dbl> | <dbl> | <dbl> | <dbl> | <dbl> | <dbl> | <dbl> | |
| X1 | 1 | 20 | 24.6 | 6.43 | 24 | 24.62 | 5.19 | 12 | 37 | 25 | -0.07 | -0.53 | 1.44 |
t.test(OBL_Expo, IND_Expo)
effsize::cohen.d(OBL_Expo, IND_Expo)
"Non-Repaid SD"
round(sd(IND_Expo),2)
"Asocial SD"
round(sd(VER_Expo),2)
Welch Two Sample t-test
data: OBL_Expo and IND_Expo
t = -0.44228, df = 32.064, p-value = 0.6613
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
-3.643344 2.343344
sample estimates:
mean of x mean of y
19.45 20.10
Cohen's d
d estimate: -0.139862 (negligible)
95 percent confidence interval:
lower upper
-0.7808138 0.5010898
library(effsize)
t.test(VER_Expo, IND_Expo)
effsize::cohen.d(VER_Expo, IND_Expo)
"Repaid SD"
round(sd(IND_Expo),2)
"Asocial SD"
round(sd(VER_Expo),2)
Welch Two Sample t-test
data: VER_Expo and IND_Expo
t = 2.7485, df = 29.398, p-value = 0.01013
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
1.153453 7.846547
sample estimates:
mean of x mean of y
24.6 20.1
Cohen's d
d estimate: 0.8691655 (large)
95 percent confidence interval:
lower upper
0.1994516 1.5388794
#"IND"
#ExpDf[(ExpDf$Generation == 2)&(ExpDf$ExpCondition == "I"),]$Exploration -> IND_Expo2nd
#round(psych::describe( IND_Expo2nd),2)
"OBL"
ExpDf[(ExpDf$Generation == 2)&(ExpDf$ExpCondition == "O"),]$Exploration -> OBL_Expo2nd
round(psych::describe( OBL_Expo2nd),2)
"VER"
ExpDf[(ExpDf$Generation == 2)&(ExpDf$ExpCondition == "V"),]$Exploration -> VER_Expo2nd
round(psych::describe( VER_Expo2nd),2)
| vars | n | mean | sd | median | trimmed | mad | min | max | range | skew | kurtosis | se | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| <dbl> | <dbl> | <dbl> | <dbl> | <dbl> | <dbl> | <dbl> | <dbl> | <dbl> | <dbl> | <dbl> | <dbl> | <dbl> | |
| X1 | 1 | 20 | 11.15 | 5.32 | 10 | 11.12 | 5.93 | 1 | 21 | 20 | 0.06 | -1.08 | 1.19 |
| vars | n | mean | sd | median | trimmed | mad | min | max | range | skew | kurtosis | se | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| <dbl> | <dbl> | <dbl> | <dbl> | <dbl> | <dbl> | <dbl> | <dbl> | <dbl> | <dbl> | <dbl> | <dbl> | <dbl> | |
| X1 | 1 | 20 | 10.65 | 7.04 | 11.5 | 10.75 | 8.15 | 0 | 21 | 21 | -0.24 | -1.35 | 1.57 |
t.test(OBL_Expo2nd, OBL_Expo, paired=TRUE )
Paired t-test
data: OBL_Expo2nd and OBL_Expo
t = -4.169, df = 19, p-value = 0.0005209
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
-12.467002 -4.132998
sample estimates:
mean of the differences
-8.3
effsize::cohen.d(OBL_Expo2nd, OBL_Expo, paired=TRUE)
Cohen's d
d estimate: -1.525274 (large)
95 percent confidence interval:
lower upper
-2.6146204 -0.4359282
t.test(VER_Expo2nd, VER_Expo, paired=TRUE )
Paired t-test
data: VER_Expo2nd and VER_Expo
t = -5.7703, df = 19, p-value = 1.467e-05
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
-19.010015 -8.889985
sample estimates:
mean of the differences
-13.95
effsize::cohen.d(VER_Expo2nd, VER_Expo, paired=TRUE)
Cohen's d
d estimate: -2.070038 (large)
95 percent confidence interval:
lower upper
-3.3574460 -0.7826294
t.test(OBL_Expo2nd, VER_Expo2nd, paired=FALSE )
Welch Two Sample t-test
data: OBL_Expo2nd and VER_Expo2nd
t = 0.25326, df = 35.368, p-value = 0.8015
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
-3.506432 4.506432
sample estimates:
mean of x mean of y
11.15 10.65
effsize::cohen.d(OBL_Expo2nd, VER_Expo2nd)
Cohen's d
d estimate: 0.0800884 (negligible)
95 percent confidence interval:
lower upper
-0.5603378 0.7205146
"OBL2"
ExpDf[(ExpDf$Generation == 2)&(ExpDf$ExpCondition == "O"),]$Exploration -> OBL_Expo2
round(psych::describe( OBL_Expo2),2)
"VER2"
ExpDf[(ExpDf$Generation == 2)&(ExpDf$ExpCondition == "V"),]$Exploration -> VER_Expo2
round(psych::describe( VER_Expo2),2)
| vars | n | mean | sd | median | trimmed | mad | min | max | range | skew | kurtosis | se | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| <dbl> | <dbl> | <dbl> | <dbl> | <dbl> | <dbl> | <dbl> | <dbl> | <dbl> | <dbl> | <dbl> | <dbl> | <dbl> | |
| X1 | 1 | 20 | 11.15 | 5.32 | 10 | 11.12 | 5.93 | 1 | 21 | 20 | 0.06 | -1.08 | 1.19 |
| vars | n | mean | sd | median | trimmed | mad | min | max | range | skew | kurtosis | se | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| <dbl> | <dbl> | <dbl> | <dbl> | <dbl> | <dbl> | <dbl> | <dbl> | <dbl> | <dbl> | <dbl> | <dbl> | <dbl> | |
| X1 | 1 | 20 | 10.65 | 7.04 | 11.5 | 10.75 | 8.15 | 0 | 21 | 21 | -0.24 | -1.35 | 1.57 |
library(effsize)
t.test(OBL_Expo2, VER_Expo2)
effsize::cohen.d(OBL_Expo2, VER_Expo2)
"Repaid SD"
round(sd(OBL_Expo2),2)
"Asocial SD"
round(sd(VER_Expo2),2)
Welch Two Sample t-test
data: OBL_Expo2 and VER_Expo2
t = 0.25326, df = 35.368, p-value = 0.8015
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
-3.506432 4.506432
sample estimates:
mean of x mean of y
11.15 10.65
Cohen's d
d estimate: 0.0800884 (negligible)
95 percent confidence interval:
lower upper
-0.5603378 0.7205146
df
| ID | ChainID | Generation | ExpCondition | Age | Gender | Trial | Choice | Length | Width | Thickness | Fitness | erroredFitness | EarnedMoney | TimeStamp | NumID | Order |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| <chr> | <int> | <int> | <chr> | <int> | <int> | <int> | <int> | <int> | <int> | <int> | <int> | <int> | <dbl> | <dbl> | <int> | <dbl> |
| I1 | 1 | 1 | I | 20 | 1 | 1 | 1 | 14 | 6 | 83 | 364 | 373 | 14.92 | 2.022012e+13 | 1 | 16 |
| I1 | 1 | 1 | I | 20 | 1 | 2 | 2 | 19 | 6 | 83 | 394 | 373 | 14.92 | 2.022012e+13 | 1 | 16 |
| I1 | 1 | 1 | I | 20 | 1 | 3 | 1 | 19 | 6 | 83 | 394 | 386 | 30.36 | 2.022012e+13 | 1 | 16 |
| I1 | 1 | 1 | I | 20 | 1 | 4 | 2 | 24 | 6 | 83 | 421 | 386 | 30.36 | 2.022012e+13 | 1 | 16 |
| I1 | 1 | 1 | I | 20 | 1 | 5 | 1 | 24 | 6 | 83 | 421 | 413 | 46.88 | 2.022012e+13 | 1 | 16 |
| I1 | 1 | 1 | I | 20 | 1 | 6 | 2 | 29 | 6 | 83 | 446 | 413 | 46.88 | 2.022012e+13 | 1 | 16 |
| I1 | 1 | 1 | I | 20 | 1 | 7 | 1 | 29 | 6 | 83 | 446 | 446 | 64.72 | 2.022012e+13 | 1 | 16 |
| I1 | 1 | 1 | I | 20 | 1 | 8 | 2 | 34 | 6 | 83 | 467 | 446 | 64.72 | 2.022012e+13 | 1 | 16 |
| I1 | 1 | 1 | I | 20 | 1 | 9 | 1 | 34 | 6 | 83 | 467 | 466 | 83.36 | 2.022012e+13 | 1 | 16 |
| I1 | 1 | 1 | I | 20 | 1 | 10 | 2 | 34 | 6 | 78 | 497 | 466 | 83.36 | 2.022012e+13 | 1 | 16 |
| I1 | 1 | 1 | I | 20 | 1 | 11 | 1 | 34 | 6 | 78 | 497 | 502 | 103.44 | 2.022012e+13 | 1 | 16 |
| I1 | 1 | 1 | I | 20 | 1 | 12 | 2 | 34 | 6 | 73 | 525 | 502 | 103.44 | 2.022012e+13 | 1 | 16 |
| I1 | 1 | 1 | I | 20 | 1 | 13 | 1 | 34 | 6 | 73 | 525 | 516 | 124.08 | 2.022012e+13 | 1 | 16 |
| I1 | 1 | 1 | I | 20 | 1 | 14 | 2 | 34 | 6 | 68 | 551 | 516 | 124.08 | 2.022012e+13 | 1 | 16 |
| I1 | 1 | 1 | I | 20 | 1 | 15 | 1 | 34 | 6 | 68 | 551 | 549 | 146.04 | 2.022012e+13 | 1 | 16 |
| I1 | 1 | 1 | I | 20 | 1 | 16 | 2 | 34 | 6 | 63 | 574 | 549 | 146.04 | 2.022012e+13 | 1 | 16 |
| I1 | 1 | 1 | I | 20 | 1 | 17 | 1 | 34 | 6 | 63 | 574 | 579 | 169.20 | 2.022012e+13 | 1 | 16 |
| I1 | 1 | 1 | I | 20 | 1 | 18 | 2 | 34 | 6 | 58 | 596 | 579 | 169.20 | 2.022012e+13 | 1 | 16 |
| I1 | 1 | 1 | I | 20 | 1 | 19 | 1 | 34 | 6 | 58 | 596 | 598 | 193.12 | 2.022012e+13 | 1 | 16 |
| I1 | 1 | 1 | I | 20 | 1 | 20 | 2 | 34 | 6 | 53 | 615 | 598 | 193.12 | 2.022012e+13 | 1 | 16 |
| I1 | 1 | 1 | I | 20 | 1 | 21 | 1 | 34 | 6 | 53 | 615 | 615 | 217.72 | 2.022012e+13 | 1 | 16 |
| I1 | 1 | 1 | I | 20 | 1 | 22 | 2 | 34 | 6 | 48 | 632 | 615 | 217.72 | 2.022012e+13 | 1 | 16 |
| I1 | 1 | 1 | I | 20 | 1 | 23 | 1 | 34 | 6 | 48 | 632 | 623 | 242.64 | 2.022012e+13 | 1 | 16 |
| I1 | 1 | 1 | I | 20 | 1 | 24 | 2 | 39 | 6 | 48 | 651 | 623 | 242.64 | 2.022012e+13 | 1 | 16 |
| I1 | 1 | 1 | I | 20 | 1 | 25 | 1 | 39 | 6 | 48 | 651 | 639 | 268.20 | 2.022012e+13 | 1 | 16 |
| I1 | 1 | 1 | I | 20 | 1 | 26 | 2 | 39 | 11 | 48 | 704 | 639 | 268.20 | 2.022012e+13 | 1 | 16 |
| I1 | 1 | 1 | I | 20 | 1 | 27 | 1 | 39 | 11 | 48 | 704 | 710 | 296.60 | 2.022012e+13 | 1 | 16 |
| I1 | 1 | 1 | I | 20 | 1 | 28 | 1 | 39 | 11 | 48 | 704 | 716 | 325.24 | 2.022012e+13 | 1 | 16 |
| I1 | 1 | 1 | I | 20 | 1 | 29 | 2 | 39 | 16 | 48 | 750 | 716 | 325.24 | 2.022012e+13 | 1 | 16 |
| I1 | 1 | 1 | I | 20 | 1 | 30 | 1 | 39 | 16 | 48 | 750 | 745 | 355.04 | 2.022012e+13 | 1 | 16 |
| ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ |
| V20 | 20 | 2 | V | 22 | 2 | 21 | 2 | 70 | 46 | 73 | 833 | 809 | 325.20 | 2.022021e+13 | 100 | 8 |
| V20 | 20 | 2 | V | 22 | 2 | 22 | 1 | 70 | 46 | 73 | 833 | 840 | 358.80 | 2.022021e+13 | 100 | 8 |
| V20 | 20 | 2 | V | 22 | 2 | 23 | 1 | 70 | 46 | 73 | 833 | 835 | 392.20 | 2.022021e+13 | 100 | 8 |
| V20 | 20 | 2 | V | 22 | 2 | 24 | 2 | 70 | 41 | 73 | 827 | 835 | 392.20 | 2.022021e+13 | 100 | 8 |
| V20 | 20 | 2 | V | 22 | 2 | 25 | 1 | 70 | 41 | 73 | 827 | 821 | 425.04 | 2.022021e+13 | 100 | 8 |
| V20 | 20 | 2 | V | 22 | 2 | 26 | 2 | 70 | 43 | 73 | 830 | 821 | 425.04 | 2.022021e+13 | 100 | 8 |
| V20 | 20 | 2 | V | 22 | 2 | 27 | 1 | 70 | 43 | 73 | 830 | 817 | 457.72 | 2.022021e+13 | 100 | 8 |
| V20 | 20 | 2 | V | 22 | 2 | 28 | 1 | 70 | 43 | 73 | 830 | 820 | 490.52 | 2.022021e+13 | 100 | 8 |
| V20 | 20 | 2 | V | 22 | 2 | 29 | 1 | 70 | 43 | 73 | 830 | 836 | 523.96 | 2.022021e+13 | 100 | 8 |
| V20 | 20 | 2 | V | 22 | 2 | 30 | 1 | 70 | 43 | 73 | 830 | 831 | 557.20 | 2.022021e+13 | 100 | 8 |
| V20 | 20 | 2 | V | 22 | 2 | 31 | 1 | 70 | 43 | 73 | 830 | 832 | 590.48 | 2.022021e+13 | 100 | 8 |
| V20 | 20 | 2 | V | 22 | 2 | 32 | 1 | 70 | 43 | 73 | 830 | 829 | 623.64 | 2.022021e+13 | 100 | 8 |
| V20 | 20 | 2 | V | 22 | 2 | 33 | 1 | 70 | 43 | 73 | 830 | 821 | 656.48 | 2.022021e+13 | 100 | 8 |
| V20 | 20 | 2 | V | 22 | 2 | 34 | 1 | 70 | 43 | 73 | 830 | 834 | 689.84 | 2.022021e+13 | 100 | 8 |
| V20 | 20 | 2 | V | 22 | 2 | 35 | 1 | 70 | 43 | 73 | 830 | 831 | 723.08 | 2.022021e+13 | 100 | 8 |
| V20 | 20 | 2 | V | 22 | 2 | 36 | 1 | 70 | 43 | 73 | 830 | 837 | 756.56 | 2.022021e+13 | 100 | 8 |
| V20 | 20 | 2 | V | 22 | 2 | 37 | 1 | 70 | 43 | 73 | 830 | 829 | 789.72 | 2.022021e+13 | 100 | 8 |
| V20 | 20 | 2 | V | 22 | 2 | 38 | 1 | 70 | 43 | 73 | 830 | 824 | 822.68 | 2.022021e+13 | 100 | 8 |
| V20 | 20 | 2 | V | 22 | 2 | 39 | 1 | 70 | 43 | 73 | 830 | 835 | 856.08 | 2.022021e+13 | 100 | 8 |
| V20 | 20 | 2 | V | 22 | 2 | 40 | 1 | 70 | 43 | 73 | 830 | 829 | 889.24 | 2.022021e+13 | 100 | 8 |
| V20 | 20 | 2 | V | 22 | 2 | 41 | 1 | 70 | 43 | 73 | 830 | 827 | 922.32 | 2.022021e+13 | 100 | 8 |
| V20 | 20 | 2 | V | 22 | 2 | 42 | 1 | 70 | 43 | 73 | 830 | 828 | 955.44 | 2.022021e+13 | 100 | 8 |
| V20 | 20 | 2 | V | 22 | 2 | 43 | 1 | 70 | 43 | 73 | 830 | 831 | 988.68 | 2.022021e+13 | 100 | 8 |
| V20 | 20 | 2 | V | 22 | 2 | 44 | 1 | 70 | 43 | 73 | 830 | 831 | 1021.92 | 2.022021e+13 | 100 | 8 |
| V20 | 20 | 2 | V | 22 | 2 | 45 | 1 | 70 | 43 | 73 | 830 | 830 | 1055.12 | 2.022021e+13 | 100 | 8 |
| V20 | 20 | 2 | V | 22 | 2 | 46 | 1 | 70 | 43 | 73 | 830 | 827 | 1088.20 | 2.022021e+13 | 100 | 8 |
| V20 | 20 | 2 | V | 22 | 2 | 47 | 1 | 70 | 43 | 73 | 830 | 826 | 1121.24 | 2.022021e+13 | 100 | 8 |
| V20 | 20 | 2 | V | 22 | 2 | 48 | 1 | 70 | 43 | 73 | 830 | 833 | 1154.56 | 2.022021e+13 | 100 | 8 |
| V20 | 20 | 2 | V | 22 | 2 | 49 | 1 | 70 | 43 | 73 | 830 | 833 | 1187.88 | 2.022021e+13 | 100 | 8 |
| V20 | 20 | 2 | V | 22 | 2 | 50 | 1 | 70 | 43 | 73 | 830 | 822 | 1220.76 | 2.022021e+13 | 100 | 8 |
## Detecting Over Explorer
LengthOptimal <- 70
WidthOptimal <-48
ThicknessOptimal<-11
OverExpLength<-(df$Length > LengthOptimal)+0
OverExpWidth<-(df$Width > WidthOptimal)+0
OverExpThickness<-(df$Thickness < ThicknessOptimal)+0
df<-dplyr::mutate(df, OverExpLength)
df<-dplyr::mutate(df, OverExpWidth)
df<-dplyr::mutate(df, OverExpThickness)
df[(df$Length > LengthOptimal)&(df$Generation == 1),]$NumID %>% unique() -> OverLengthIDG1
df[(df$Width > WidthOptimal)&(df$Generation == 1),]$NumID %>% unique() -> OverWidthIDG1
df[(df$Thickness < ThicknessOptimal)&(df$Generation == 1),]$NumID %>% unique() -> OverThicknessIDG1
df[(df$Length > LengthOptimal)&(df$Generation == 2),]$NumID %>% unique() -> OverLengthIDG2
df[(df$Width > WidthOptimal)&(df$Generation == 2),]$NumID %>% unique() -> OverWidthIDG2
df[(df$Thickness < ThicknessOptimal)&(df$Generation == 2),]$NumID %>% unique() -> OverThicknessIDG2
"L, G1"
OverLengthIDG1
length(OverLengthIDG1)
"W, G1"
OverWidthIDG1
length(OverWidthIDG1)
"T, G1"
OverThicknessIDG1
length(OverThicknessIDG1)
"Total, G1"
c(OverLengthIDG1, OverWidthIDG1, OverThicknessIDG1) %>% unique()
c(OverLengthIDG1, OverWidthIDG1, OverThicknessIDG1) %>% unique() %>% length()
OverLengthIDG2
OverWidthIDG2
OverThicknessIDG2
"Geneartion1"
"L,W,T"
df[(df$Length > LengthOptimal)&(df$Generation == 1),]$ID %>% unique() ->OLIDG1
df[(df$Width > WidthOptimal)&(df$Generation == 1),]$ID %>% unique() ->OWIDG1
df[(df$Thickness < ThicknessOptimal)&(df$Generation == 1),]$ID %>% unique() -> OTIDG1
OLIDG1
OWIDG1
OTIDG1
c(OLIDG1,OWIDG1,OTIDG1)%>% unique() -> AllIDG1
#c(OLIDG1,OWIDG1,OTIDG1)%>% unique() %>% length
OverIndNG1 <- str_detect(AllIDG1, pattern="I") %>% sum()
OverOblNG1 <- str_detect(AllIDG1, pattern="O") %>% sum()
OverVerNG1 <- str_detect(AllIDG1, pattern="V") %>% sum()
OverExpSummaryG1<-c(OverIndNG1 , OverOblNG1, OverVerNG1)
OverExpSummaryG1
"Geneartion2"
"L,W,T"
df[(df$Length > LengthOptimal)&(df$Generation == 2),]$ID %>% unique() ->OLIDG2
df[(df$Width > WidthOptimal)&(df$Generation == 2),]$ID %>% unique() ->OWIDG2
df[(df$Thickness < ThicknessOptimal)&(df$Generation == 2),]$ID %>% unique() -> OTIDG2
OLIDG2
OWIDG2
OTIDG2
c(OLIDG2,OWIDG2,OTIDG2)%>% unique() -> AllIDG2
#c(OLIDG2,OWIDG2,OTIDG2)%>% unique() %>% length
OverIndNG2<- str_detect(AllIDG2, pattern="I") %>% sum()
OverOblNG2 <- str_detect(AllIDG2, pattern="O") %>% sum()
OverVerNG2 <- str_detect(AllIDG2, pattern="V") %>% sum()
OverExpSummaryG2<-c(OverIndNG2 , OverOblNG2, OverVerNG2)
OverExpSummaryG2
rbind(OverExpSummaryG1, OverExpSummaryG2) %>% data.frame() -> OverExpSummary
colnames(OverExpSummary)<-c("asocial","unrepaid","repaid")
rownames(OverExpSummary)<-c("G1","G2")
OverExpSummary
OverExpSummary/20
| asocial | unrepaid | repaid | |
|---|---|---|---|
| <int> | <int> | <int> | |
| G1 | 3 | 3 | 11 |
| G2 | 0 | 14 | 15 |
| asocial | unrepaid | repaid | |
|---|---|---|---|
| <dbl> | <dbl> | <dbl> | |
| G1 | 0.15 | 0.15 | 0.55 |
| G2 | 0.00 | 0.70 | 0.75 |
OverExpLength<-(df$Length > LengthOptimal)+0
OverExpWidth<-(df$Width > WidthOptimal)+0
OverExpThickness<-(df$Thickness < ThicknessOptimal)+0
df
| ID | ChainID | Generation | ExpCondition | Age | Gender | Trial | Choice | Length | Width | Thickness | Fitness | erroredFitness | EarnedMoney | TimeStamp | NumID | Order | OverExpLength | OverExpWidth | OverExpThickness |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| <chr> | <int> | <int> | <chr> | <int> | <int> | <int> | <int> | <int> | <int> | <int> | <int> | <int> | <dbl> | <dbl> | <int> | <dbl> | <dbl> | <dbl> | <dbl> |
| I1 | 1 | 1 | I | 20 | 1 | 1 | 1 | 14 | 6 | 83 | 364 | 373 | 14.92 | 2.022012e+13 | 1 | 16 | 0 | 0 | 0 |
| I1 | 1 | 1 | I | 20 | 1 | 2 | 2 | 19 | 6 | 83 | 394 | 373 | 14.92 | 2.022012e+13 | 1 | 16 | 0 | 0 | 0 |
| I1 | 1 | 1 | I | 20 | 1 | 3 | 1 | 19 | 6 | 83 | 394 | 386 | 30.36 | 2.022012e+13 | 1 | 16 | 0 | 0 | 0 |
| I1 | 1 | 1 | I | 20 | 1 | 4 | 2 | 24 | 6 | 83 | 421 | 386 | 30.36 | 2.022012e+13 | 1 | 16 | 0 | 0 | 0 |
| I1 | 1 | 1 | I | 20 | 1 | 5 | 1 | 24 | 6 | 83 | 421 | 413 | 46.88 | 2.022012e+13 | 1 | 16 | 0 | 0 | 0 |
| I1 | 1 | 1 | I | 20 | 1 | 6 | 2 | 29 | 6 | 83 | 446 | 413 | 46.88 | 2.022012e+13 | 1 | 16 | 0 | 0 | 0 |
| I1 | 1 | 1 | I | 20 | 1 | 7 | 1 | 29 | 6 | 83 | 446 | 446 | 64.72 | 2.022012e+13 | 1 | 16 | 0 | 0 | 0 |
| I1 | 1 | 1 | I | 20 | 1 | 8 | 2 | 34 | 6 | 83 | 467 | 446 | 64.72 | 2.022012e+13 | 1 | 16 | 0 | 0 | 0 |
| I1 | 1 | 1 | I | 20 | 1 | 9 | 1 | 34 | 6 | 83 | 467 | 466 | 83.36 | 2.022012e+13 | 1 | 16 | 0 | 0 | 0 |
| I1 | 1 | 1 | I | 20 | 1 | 10 | 2 | 34 | 6 | 78 | 497 | 466 | 83.36 | 2.022012e+13 | 1 | 16 | 0 | 0 | 0 |
| I1 | 1 | 1 | I | 20 | 1 | 11 | 1 | 34 | 6 | 78 | 497 | 502 | 103.44 | 2.022012e+13 | 1 | 16 | 0 | 0 | 0 |
| I1 | 1 | 1 | I | 20 | 1 | 12 | 2 | 34 | 6 | 73 | 525 | 502 | 103.44 | 2.022012e+13 | 1 | 16 | 0 | 0 | 0 |
| I1 | 1 | 1 | I | 20 | 1 | 13 | 1 | 34 | 6 | 73 | 525 | 516 | 124.08 | 2.022012e+13 | 1 | 16 | 0 | 0 | 0 |
| I1 | 1 | 1 | I | 20 | 1 | 14 | 2 | 34 | 6 | 68 | 551 | 516 | 124.08 | 2.022012e+13 | 1 | 16 | 0 | 0 | 0 |
| I1 | 1 | 1 | I | 20 | 1 | 15 | 1 | 34 | 6 | 68 | 551 | 549 | 146.04 | 2.022012e+13 | 1 | 16 | 0 | 0 | 0 |
| I1 | 1 | 1 | I | 20 | 1 | 16 | 2 | 34 | 6 | 63 | 574 | 549 | 146.04 | 2.022012e+13 | 1 | 16 | 0 | 0 | 0 |
| I1 | 1 | 1 | I | 20 | 1 | 17 | 1 | 34 | 6 | 63 | 574 | 579 | 169.20 | 2.022012e+13 | 1 | 16 | 0 | 0 | 0 |
| I1 | 1 | 1 | I | 20 | 1 | 18 | 2 | 34 | 6 | 58 | 596 | 579 | 169.20 | 2.022012e+13 | 1 | 16 | 0 | 0 | 0 |
| I1 | 1 | 1 | I | 20 | 1 | 19 | 1 | 34 | 6 | 58 | 596 | 598 | 193.12 | 2.022012e+13 | 1 | 16 | 0 | 0 | 0 |
| I1 | 1 | 1 | I | 20 | 1 | 20 | 2 | 34 | 6 | 53 | 615 | 598 | 193.12 | 2.022012e+13 | 1 | 16 | 0 | 0 | 0 |
| I1 | 1 | 1 | I | 20 | 1 | 21 | 1 | 34 | 6 | 53 | 615 | 615 | 217.72 | 2.022012e+13 | 1 | 16 | 0 | 0 | 0 |
| I1 | 1 | 1 | I | 20 | 1 | 22 | 2 | 34 | 6 | 48 | 632 | 615 | 217.72 | 2.022012e+13 | 1 | 16 | 0 | 0 | 0 |
| I1 | 1 | 1 | I | 20 | 1 | 23 | 1 | 34 | 6 | 48 | 632 | 623 | 242.64 | 2.022012e+13 | 1 | 16 | 0 | 0 | 0 |
| I1 | 1 | 1 | I | 20 | 1 | 24 | 2 | 39 | 6 | 48 | 651 | 623 | 242.64 | 2.022012e+13 | 1 | 16 | 0 | 0 | 0 |
| I1 | 1 | 1 | I | 20 | 1 | 25 | 1 | 39 | 6 | 48 | 651 | 639 | 268.20 | 2.022012e+13 | 1 | 16 | 0 | 0 | 0 |
| I1 | 1 | 1 | I | 20 | 1 | 26 | 2 | 39 | 11 | 48 | 704 | 639 | 268.20 | 2.022012e+13 | 1 | 16 | 0 | 0 | 0 |
| I1 | 1 | 1 | I | 20 | 1 | 27 | 1 | 39 | 11 | 48 | 704 | 710 | 296.60 | 2.022012e+13 | 1 | 16 | 0 | 0 | 0 |
| I1 | 1 | 1 | I | 20 | 1 | 28 | 1 | 39 | 11 | 48 | 704 | 716 | 325.24 | 2.022012e+13 | 1 | 16 | 0 | 0 | 0 |
| I1 | 1 | 1 | I | 20 | 1 | 29 | 2 | 39 | 16 | 48 | 750 | 716 | 325.24 | 2.022012e+13 | 1 | 16 | 0 | 0 | 0 |
| I1 | 1 | 1 | I | 20 | 1 | 30 | 1 | 39 | 16 | 48 | 750 | 745 | 355.04 | 2.022012e+13 | 1 | 16 | 0 | 0 | 0 |
| ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ |
| V20 | 20 | 2 | V | 22 | 2 | 21 | 2 | 70 | 46 | 73 | 833 | 809 | 325.20 | 2.022021e+13 | 100 | 8 | 0 | 0 | 0 |
| V20 | 20 | 2 | V | 22 | 2 | 22 | 1 | 70 | 46 | 73 | 833 | 840 | 358.80 | 2.022021e+13 | 100 | 8 | 0 | 0 | 0 |
| V20 | 20 | 2 | V | 22 | 2 | 23 | 1 | 70 | 46 | 73 | 833 | 835 | 392.20 | 2.022021e+13 | 100 | 8 | 0 | 0 | 0 |
| V20 | 20 | 2 | V | 22 | 2 | 24 | 2 | 70 | 41 | 73 | 827 | 835 | 392.20 | 2.022021e+13 | 100 | 8 | 0 | 0 | 0 |
| V20 | 20 | 2 | V | 22 | 2 | 25 | 1 | 70 | 41 | 73 | 827 | 821 | 425.04 | 2.022021e+13 | 100 | 8 | 0 | 0 | 0 |
| V20 | 20 | 2 | V | 22 | 2 | 26 | 2 | 70 | 43 | 73 | 830 | 821 | 425.04 | 2.022021e+13 | 100 | 8 | 0 | 0 | 0 |
| V20 | 20 | 2 | V | 22 | 2 | 27 | 1 | 70 | 43 | 73 | 830 | 817 | 457.72 | 2.022021e+13 | 100 | 8 | 0 | 0 | 0 |
| V20 | 20 | 2 | V | 22 | 2 | 28 | 1 | 70 | 43 | 73 | 830 | 820 | 490.52 | 2.022021e+13 | 100 | 8 | 0 | 0 | 0 |
| V20 | 20 | 2 | V | 22 | 2 | 29 | 1 | 70 | 43 | 73 | 830 | 836 | 523.96 | 2.022021e+13 | 100 | 8 | 0 | 0 | 0 |
| V20 | 20 | 2 | V | 22 | 2 | 30 | 1 | 70 | 43 | 73 | 830 | 831 | 557.20 | 2.022021e+13 | 100 | 8 | 0 | 0 | 0 |
| V20 | 20 | 2 | V | 22 | 2 | 31 | 1 | 70 | 43 | 73 | 830 | 832 | 590.48 | 2.022021e+13 | 100 | 8 | 0 | 0 | 0 |
| V20 | 20 | 2 | V | 22 | 2 | 32 | 1 | 70 | 43 | 73 | 830 | 829 | 623.64 | 2.022021e+13 | 100 | 8 | 0 | 0 | 0 |
| V20 | 20 | 2 | V | 22 | 2 | 33 | 1 | 70 | 43 | 73 | 830 | 821 | 656.48 | 2.022021e+13 | 100 | 8 | 0 | 0 | 0 |
| V20 | 20 | 2 | V | 22 | 2 | 34 | 1 | 70 | 43 | 73 | 830 | 834 | 689.84 | 2.022021e+13 | 100 | 8 | 0 | 0 | 0 |
| V20 | 20 | 2 | V | 22 | 2 | 35 | 1 | 70 | 43 | 73 | 830 | 831 | 723.08 | 2.022021e+13 | 100 | 8 | 0 | 0 | 0 |
| V20 | 20 | 2 | V | 22 | 2 | 36 | 1 | 70 | 43 | 73 | 830 | 837 | 756.56 | 2.022021e+13 | 100 | 8 | 0 | 0 | 0 |
| V20 | 20 | 2 | V | 22 | 2 | 37 | 1 | 70 | 43 | 73 | 830 | 829 | 789.72 | 2.022021e+13 | 100 | 8 | 0 | 0 | 0 |
| V20 | 20 | 2 | V | 22 | 2 | 38 | 1 | 70 | 43 | 73 | 830 | 824 | 822.68 | 2.022021e+13 | 100 | 8 | 0 | 0 | 0 |
| V20 | 20 | 2 | V | 22 | 2 | 39 | 1 | 70 | 43 | 73 | 830 | 835 | 856.08 | 2.022021e+13 | 100 | 8 | 0 | 0 | 0 |
| V20 | 20 | 2 | V | 22 | 2 | 40 | 1 | 70 | 43 | 73 | 830 | 829 | 889.24 | 2.022021e+13 | 100 | 8 | 0 | 0 | 0 |
| V20 | 20 | 2 | V | 22 | 2 | 41 | 1 | 70 | 43 | 73 | 830 | 827 | 922.32 | 2.022021e+13 | 100 | 8 | 0 | 0 | 0 |
| V20 | 20 | 2 | V | 22 | 2 | 42 | 1 | 70 | 43 | 73 | 830 | 828 | 955.44 | 2.022021e+13 | 100 | 8 | 0 | 0 | 0 |
| V20 | 20 | 2 | V | 22 | 2 | 43 | 1 | 70 | 43 | 73 | 830 | 831 | 988.68 | 2.022021e+13 | 100 | 8 | 0 | 0 | 0 |
| V20 | 20 | 2 | V | 22 | 2 | 44 | 1 | 70 | 43 | 73 | 830 | 831 | 1021.92 | 2.022021e+13 | 100 | 8 | 0 | 0 | 0 |
| V20 | 20 | 2 | V | 22 | 2 | 45 | 1 | 70 | 43 | 73 | 830 | 830 | 1055.12 | 2.022021e+13 | 100 | 8 | 0 | 0 | 0 |
| V20 | 20 | 2 | V | 22 | 2 | 46 | 1 | 70 | 43 | 73 | 830 | 827 | 1088.20 | 2.022021e+13 | 100 | 8 | 0 | 0 | 0 |
| V20 | 20 | 2 | V | 22 | 2 | 47 | 1 | 70 | 43 | 73 | 830 | 826 | 1121.24 | 2.022021e+13 | 100 | 8 | 0 | 0 | 0 |
| V20 | 20 | 2 | V | 22 | 2 | 48 | 1 | 70 | 43 | 73 | 830 | 833 | 1154.56 | 2.022021e+13 | 100 | 8 | 0 | 0 | 0 |
| V20 | 20 | 2 | V | 22 | 2 | 49 | 1 | 70 | 43 | 73 | 830 | 833 | 1187.88 | 2.022021e+13 | 100 | 8 | 0 | 0 | 0 |
| V20 | 20 | 2 | V | 22 | 2 | 50 | 1 | 70 | 43 | 73 | 830 | 822 | 1220.76 | 2.022021e+13 | 100 | 8 | 0 | 0 | 0 |
df[(df$Length > LengthOptimal)|(df$Generation==1) ,]
| ID | ChainID | Generation | ExpCondition | Age | Gender | Trial | Choice | Length | Width | Thickness | Fitness | erroredFitness | EarnedMoney | TimeStamp | NumID | Order | OverExpLength | OverExpWidth | OverExpThickness | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| <chr> | <int> | <int> | <chr> | <int> | <int> | <int> | <int> | <int> | <int> | <int> | <int> | <int> | <dbl> | <dbl> | <int> | <dbl> | <dbl> | <dbl> | <dbl> | |
| 1 | I1 | 1 | 1 | I | 20 | 1 | 1 | 1 | 14 | 6 | 83 | 364 | 373 | 14.92 | 2.022012e+13 | 1 | 16 | 0 | 0 | 0 |
| 2 | I1 | 1 | 1 | I | 20 | 1 | 2 | 2 | 19 | 6 | 83 | 394 | 373 | 14.92 | 2.022012e+13 | 1 | 16 | 0 | 0 | 0 |
| 3 | I1 | 1 | 1 | I | 20 | 1 | 3 | 1 | 19 | 6 | 83 | 394 | 386 | 30.36 | 2.022012e+13 | 1 | 16 | 0 | 0 | 0 |
| 4 | I1 | 1 | 1 | I | 20 | 1 | 4 | 2 | 24 | 6 | 83 | 421 | 386 | 30.36 | 2.022012e+13 | 1 | 16 | 0 | 0 | 0 |
| 5 | I1 | 1 | 1 | I | 20 | 1 | 5 | 1 | 24 | 6 | 83 | 421 | 413 | 46.88 | 2.022012e+13 | 1 | 16 | 0 | 0 | 0 |
| 6 | I1 | 1 | 1 | I | 20 | 1 | 6 | 2 | 29 | 6 | 83 | 446 | 413 | 46.88 | 2.022012e+13 | 1 | 16 | 0 | 0 | 0 |
| 7 | I1 | 1 | 1 | I | 20 | 1 | 7 | 1 | 29 | 6 | 83 | 446 | 446 | 64.72 | 2.022012e+13 | 1 | 16 | 0 | 0 | 0 |
| 8 | I1 | 1 | 1 | I | 20 | 1 | 8 | 2 | 34 | 6 | 83 | 467 | 446 | 64.72 | 2.022012e+13 | 1 | 16 | 0 | 0 | 0 |
| 9 | I1 | 1 | 1 | I | 20 | 1 | 9 | 1 | 34 | 6 | 83 | 467 | 466 | 83.36 | 2.022012e+13 | 1 | 16 | 0 | 0 | 0 |
| 10 | I1 | 1 | 1 | I | 20 | 1 | 10 | 2 | 34 | 6 | 78 | 497 | 466 | 83.36 | 2.022012e+13 | 1 | 16 | 0 | 0 | 0 |
| 11 | I1 | 1 | 1 | I | 20 | 1 | 11 | 1 | 34 | 6 | 78 | 497 | 502 | 103.44 | 2.022012e+13 | 1 | 16 | 0 | 0 | 0 |
| 12 | I1 | 1 | 1 | I | 20 | 1 | 12 | 2 | 34 | 6 | 73 | 525 | 502 | 103.44 | 2.022012e+13 | 1 | 16 | 0 | 0 | 0 |
| 13 | I1 | 1 | 1 | I | 20 | 1 | 13 | 1 | 34 | 6 | 73 | 525 | 516 | 124.08 | 2.022012e+13 | 1 | 16 | 0 | 0 | 0 |
| 14 | I1 | 1 | 1 | I | 20 | 1 | 14 | 2 | 34 | 6 | 68 | 551 | 516 | 124.08 | 2.022012e+13 | 1 | 16 | 0 | 0 | 0 |
| 15 | I1 | 1 | 1 | I | 20 | 1 | 15 | 1 | 34 | 6 | 68 | 551 | 549 | 146.04 | 2.022012e+13 | 1 | 16 | 0 | 0 | 0 |
| 16 | I1 | 1 | 1 | I | 20 | 1 | 16 | 2 | 34 | 6 | 63 | 574 | 549 | 146.04 | 2.022012e+13 | 1 | 16 | 0 | 0 | 0 |
| 17 | I1 | 1 | 1 | I | 20 | 1 | 17 | 1 | 34 | 6 | 63 | 574 | 579 | 169.20 | 2.022012e+13 | 1 | 16 | 0 | 0 | 0 |
| 18 | I1 | 1 | 1 | I | 20 | 1 | 18 | 2 | 34 | 6 | 58 | 596 | 579 | 169.20 | 2.022012e+13 | 1 | 16 | 0 | 0 | 0 |
| 19 | I1 | 1 | 1 | I | 20 | 1 | 19 | 1 | 34 | 6 | 58 | 596 | 598 | 193.12 | 2.022012e+13 | 1 | 16 | 0 | 0 | 0 |
| 20 | I1 | 1 | 1 | I | 20 | 1 | 20 | 2 | 34 | 6 | 53 | 615 | 598 | 193.12 | 2.022012e+13 | 1 | 16 | 0 | 0 | 0 |
| 21 | I1 | 1 | 1 | I | 20 | 1 | 21 | 1 | 34 | 6 | 53 | 615 | 615 | 217.72 | 2.022012e+13 | 1 | 16 | 0 | 0 | 0 |
| 22 | I1 | 1 | 1 | I | 20 | 1 | 22 | 2 | 34 | 6 | 48 | 632 | 615 | 217.72 | 2.022012e+13 | 1 | 16 | 0 | 0 | 0 |
| 23 | I1 | 1 | 1 | I | 20 | 1 | 23 | 1 | 34 | 6 | 48 | 632 | 623 | 242.64 | 2.022012e+13 | 1 | 16 | 0 | 0 | 0 |
| 24 | I1 | 1 | 1 | I | 20 | 1 | 24 | 2 | 39 | 6 | 48 | 651 | 623 | 242.64 | 2.022012e+13 | 1 | 16 | 0 | 0 | 0 |
| 25 | I1 | 1 | 1 | I | 20 | 1 | 25 | 1 | 39 | 6 | 48 | 651 | 639 | 268.20 | 2.022012e+13 | 1 | 16 | 0 | 0 | 0 |
| 26 | I1 | 1 | 1 | I | 20 | 1 | 26 | 2 | 39 | 11 | 48 | 704 | 639 | 268.20 | 2.022012e+13 | 1 | 16 | 0 | 0 | 0 |
| 27 | I1 | 1 | 1 | I | 20 | 1 | 27 | 1 | 39 | 11 | 48 | 704 | 710 | 296.60 | 2.022012e+13 | 1 | 16 | 0 | 0 | 0 |
| 28 | I1 | 1 | 1 | I | 20 | 1 | 28 | 1 | 39 | 11 | 48 | 704 | 716 | 325.24 | 2.022012e+13 | 1 | 16 | 0 | 0 | 0 |
| 29 | I1 | 1 | 1 | I | 20 | 1 | 29 | 2 | 39 | 16 | 48 | 750 | 716 | 325.24 | 2.022012e+13 | 1 | 16 | 0 | 0 | 0 |
| 30 | I1 | 1 | 1 | I | 20 | 1 | 30 | 1 | 39 | 16 | 48 | 750 | 745 | 355.04 | 2.022012e+13 | 1 | 16 | 0 | 0 | 0 |
| ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ |
| 4928 | V20 | 20 | 1 | V | 20 | 3 | 28 | 2 | 54 | 31 | 83 | 723 | 704 | 254.44 | 2.022021e+13 | 99 | 7 | 0 | 0 | 0 |
| 4929 | V20 | 20 | 1 | V | 20 | 3 | 29 | 2 | 54 | 36 | 83 | 742 | 704 | 254.44 | 2.022021e+13 | 99 | 7 | 0 | 0 | 0 |
| 4930 | V20 | 20 | 1 | V | 20 | 3 | 30 | 1 | 54 | 36 | 83 | 742 | 743 | 284.16 | 2.022021e+13 | 99 | 7 | 0 | 0 | 0 |
| 4931 | V20 | 20 | 1 | V | 20 | 3 | 31 | 2 | 54 | 41 | 83 | 755 | 743 | 284.16 | 2.022021e+13 | 99 | 7 | 0 | 0 | 0 |
| 4932 | V20 | 20 | 1 | V | 20 | 3 | 32 | 1 | 54 | 41 | 83 | 755 | 757 | 314.44 | 2.022021e+13 | 99 | 7 | 0 | 0 | 0 |
| 4933 | V20 | 20 | 1 | V | 20 | 3 | 33 | 2 | 54 | 41 | 88 | 722 | 757 | 314.44 | 2.022021e+13 | 99 | 7 | 0 | 0 | 0 |
| 4934 | V20 | 20 | 1 | V | 20 | 3 | 34 | 1 | 54 | 41 | 88 | 722 | 724 | 343.40 | 2.022021e+13 | 99 | 7 | 0 | 0 | 0 |
| 4935 | V20 | 20 | 1 | V | 20 | 3 | 35 | 2 | 54 | 41 | 83 | 755 | 724 | 343.40 | 2.022021e+13 | 99 | 7 | 0 | 0 | 0 |
| 4936 | V20 | 20 | 1 | V | 20 | 3 | 36 | 2 | 54 | 41 | 78 | 785 | 724 | 343.40 | 2.022021e+13 | 99 | 7 | 0 | 0 | 0 |
| 4937 | V20 | 20 | 1 | V | 20 | 3 | 37 | 1 | 54 | 41 | 78 | 785 | 780 | 374.60 | 2.022021e+13 | 99 | 7 | 0 | 0 | 0 |
| 4938 | V20 | 20 | 1 | V | 20 | 3 | 38 | 2 | 54 | 41 | 73 | 812 | 780 | 374.60 | 2.022021e+13 | 99 | 7 | 0 | 0 | 0 |
| 4939 | V20 | 20 | 1 | V | 20 | 3 | 39 | 1 | 54 | 41 | 73 | 812 | 810 | 407.00 | 2.022021e+13 | 99 | 7 | 0 | 0 | 0 |
| 4940 | V20 | 20 | 1 | V | 20 | 3 | 40 | 2 | 54 | 41 | 68 | 838 | 810 | 407.00 | 2.022021e+13 | 99 | 7 | 0 | 0 | 0 |
| 4941 | V20 | 20 | 1 | V | 20 | 3 | 41 | 1 | 54 | 41 | 68 | 838 | 840 | 440.60 | 2.022021e+13 | 99 | 7 | 0 | 0 | 0 |
| 4942 | V20 | 20 | 1 | V | 20 | 3 | 42 | 2 | 59 | 41 | 68 | 846 | 840 | 440.60 | 2.022021e+13 | 99 | 7 | 0 | 0 | 0 |
| 4943 | V20 | 20 | 1 | V | 20 | 3 | 43 | 1 | 59 | 41 | 68 | 846 | 852 | 474.68 | 2.022021e+13 | 99 | 7 | 0 | 0 | 0 |
| 4944 | V20 | 20 | 1 | V | 20 | 3 | 44 | 2 | 59 | 46 | 68 | 852 | 852 | 474.68 | 2.022021e+13 | 99 | 7 | 0 | 0 | 0 |
| 4945 | V20 | 20 | 1 | V | 20 | 3 | 45 | 1 | 59 | 46 | 68 | 852 | 852 | 508.76 | 2.022021e+13 | 99 | 7 | 0 | 0 | 0 |
| 4946 | V20 | 20 | 1 | V | 20 | 3 | 46 | 2 | 64 | 46 | 68 | 857 | 852 | 508.76 | 2.022021e+13 | 99 | 7 | 0 | 0 | 0 |
| 4947 | V20 | 20 | 1 | V | 20 | 3 | 47 | 1 | 64 | 46 | 68 | 857 | 854 | 542.92 | 2.022021e+13 | 99 | 7 | 0 | 0 | 0 |
| 4948 | V20 | 20 | 1 | V | 20 | 3 | 48 | 2 | 64 | 41 | 68 | 851 | 854 | 542.92 | 2.022021e+13 | 99 | 7 | 0 | 0 | 0 |
| 4949 | V20 | 20 | 1 | V | 20 | 3 | 49 | 1 | 64 | 41 | 68 | 851 | 857 | 577.20 | 2.022021e+13 | 99 | 7 | 0 | 0 | 0 |
| 4950 | V20 | 20 | 1 | V | 20 | 3 | 50 | 1 | 64 | 41 | 68 | 851 | 855 | 611.40 | 2.022021e+13 | 99 | 7 | 0 | 0 | 0 |
| 4958 | V20 | 20 | 2 | V | 22 | 2 | 8 | 2 | 74 | 51 | 73 | 831 | 832 | 100.24 | 2.022021e+13 | 100 | 8 | 1 | 1 | 0 |
| 4959 | V20 | 20 | 2 | V | 22 | 2 | 9 | 1 | 74 | 51 | 73 | 831 | 836 | 133.68 | 2.022021e+13 | 100 | 8 | 1 | 1 | 0 |
| 4960 | V20 | 20 | 2 | V | 22 | 2 | 10 | 2 | 74 | 51 | 78 | 803 | 836 | 133.68 | 2.022021e+13 | 100 | 8 | 1 | 1 | 0 |
| 4961 | V20 | 20 | 2 | V | 22 | 2 | 11 | 1 | 74 | 51 | 78 | 803 | 792 | 165.36 | 2.022021e+13 | 100 | 8 | 1 | 1 | 0 |
| 4962 | V20 | 20 | 2 | V | 22 | 2 | 12 | 1 | 74 | 51 | 78 | 803 | 793 | 197.08 | 2.022021e+13 | 100 | 8 | 1 | 1 | 0 |
| 4963 | V20 | 20 | 2 | V | 22 | 2 | 13 | 2 | 74 | 56 | 78 | 796 | 793 | 197.08 | 2.022021e+13 | 100 | 8 | 1 | 1 | 0 |
| 4964 | V20 | 20 | 2 | V | 22 | 2 | 14 | 1 | 74 | 56 | 78 | 796 | 792 | 228.76 | 2.022021e+13 | 100 | 8 | 1 | 1 | 0 |
labeli <- as_labeller(c("I" = "Asocial",
"O" = "Unnrepaid",
"V" = "Repaid",
"1"="First Generation","2"="Second Generation"))
options(repr.plot.width=10, repr.plot.height=10)
ggplot(df, aes(x=Trial,y=Length, group = as.factor(ID), color = as.factor(ChainID))) +
geom_point(alpha =0.5)+ geom_line(alpha=0.6)+
geom_hline(yintercept = 70, size = 0.6, linetype = 1) +
ylim(0,100)+
theme_bw()+
guides(color=guide_legend(title="ID"))+theme(legend.position = "none")+
theme(text = element_text(size = 16))+
facet_grid(ExpCondition ~ Generation,labeller = labeli) -> Lplot
Lplot
labeli <- as_labeller(c("I" = "Asocial",
"O" = "Unrepaid",
"V" = "Repaid",
"1"="First Generation","2"="Second Generation"))
options(repr.plot.width=12, repr.plot.height=12)
ggplot(df, aes(x=Trial,y=Length, group = as.factor(ID), color = as.factor(OverExpLength))) +
geom_point(alpha =0.5)+ geom_line(alpha=0.5)+
guides(color=guide_legend(title="Overexploration"))+
geom_hline(yintercept = 70, size = 0.6, linetype = 1) +
ylim(0,100)+
theme_bw()+
theme(text = element_text(size = 16))+
facet_grid(ExpCondition ~ Generation,labeller = labeli)
options(repr.plot.width=10, repr.plot.height=10)
ggplot(df, aes(x=Trial,y=Width, group = as.factor(ID), color = as.factor(ChainID), alpha = 0.2)) +
geom_point(alpha =0.5)+ geom_line(alpha=0.6)+
geom_hline(yintercept = 48, size = 0.6, linetype = 1) +
ylim(0,100)+
theme_bw()+
theme(text = element_text(size = 16))+
guides(color=guide_legend(title="ID"))+theme(legend.position = "none")+
facet_grid(ExpCondition ~ Generation,labeller = labeli) -> Wplot
Wplot
options(repr.plot.width=12, repr.plot.height=12)
ggplot(df, aes(x=Trial,y=Width, group = as.factor(ID), color = as.factor(OverExpWidth), alpha = 0.2)) +
geom_point(alpha =0.5)+ geom_line(alpha=0.5)+
guides(color=guide_legend(title="Overexploration"))+
geom_hline(yintercept = 48, size = 0.6, linetype = 1) +
ylim(0,100)+
theme_bw()+
theme(text = element_text(size = 16))+
facet_grid(ExpCondition ~ Generation,labeller = labeli)
options(repr.plot.width=10, repr.plot.height=10)
ggplot(df, aes(x=Trial,y=Thickness, group = as.factor(ID), color = as.factor(ChainID))) +
geom_point(alpha =0.5)+ geom_line(alpha=0.6)+
geom_hline(yintercept = 11, size = 0.6, linetype = 1) +
ylim(0,100)+
theme_bw()+
theme(text = element_text(size = 16))+
guides(color=guide_legend(title="ID"))+theme(legend.position = "none")+
facet_grid(ExpCondition ~ Generation,labeller = labeli) -> Tplot
Tplot
options(repr.plot.width=12, repr.plot.height=12)
ggplot(df, aes(x=Trial,y=Thickness, group = as.factor(ID), color = as.factor(OverExpThickness), alpha = 0.2)) +
geom_point(alpha =0.5)+ geom_line(alpha=0.5)+
guides(color=guide_legend(title="Overexploration"))+
geom_hline(yintercept = 11, size = 0.6, linetype = 1) +
ylim(0,100)+
theme_bw()+
theme(text = element_text(size = 16))+
facet_grid(ExpCondition ~ Generation,labeller = labeli)
options(repr.plot.width=12, repr.plot.height=12)
y_title <- expression("Cumulative payoff")
x_title <- expression("Trial")
labeli <- as_labeller(c("I" = "Asocial",
"O" = "Nonrepaid",
"V" = "Repaid",
"1"="First Geneartion",
"2"="Second Generation"))
#options(repr.plot.width=6., repr.plot.height=6.5)
df %>% ggplot(aes(x=Trial,y=as.numeric(EarnedMoney/2)))+
geom_line(aes(group =ChainID, color = as.factor(ChainID)), alpha = 0.3)+
geom_point(aes(group =ChainID, color = as.factor(ChainID)), alpha = 0.5)+
facet_grid(ExpCondition ~ Generation, labeller=labeli ) +
theme_bw() +theme(legend.position = "none")+
stat_summary(fun="mean", geom="line", alpha = 1, size = 1.3) +
stat_summary(fun="mean", geom="point", alpha = 1, size = 1.6)+
ylab(y_title)+xlab(x_title)+theme(text = element_text(size = 16))+
stat_summary(fun = mean,
fun.min = function(x) mean(x) - sd(x)/sqrt(length(x)),
fun.max = function(x) mean(x) + sd(x)/sqrt(length(x)),
alpha = 0.8, geom = "linerange", size =0.5)+geom_hline(yintercept = 364, size = 0.4, linetype = 5) -> CPayoffG
CPayoffG
library(gridExtra)
options(repr.plot.width=26, repr.plot.height=12)
grid.arrange(Lplot, Wplot, Tplot, nrow = 1) -> LWTg
LWTg
ggsave("Figures/LWTshift.pdf",LWTg, dpi = 220, device = "pdf", width = 26, height = 12)
Attaching package: ‘gridExtra’
The following object is masked from ‘package:dplyr’:
combine
TableGrob (1 x 3) "arrange": 3 grobs z cells name grob 1 1 (1-1,1-1) arrange gtable[layout] 2 2 (1-1,2-2) arrange gtable[layout] 3 3 (1-1,3-3) arrange gtable[layout]
library(gridExtra)
options(repr.plot.width=18, repr.plot.height=18)
layout <- rbind(c(1, 2),
c(3, 4))
grid.arrange(Lplot, Wplot, Tplot, CPayoffG, layout_matrix =layout) -> LWTPayoffgraph
ggsave("Figures/LWTshiftPayoff.pdf", LWTPayoffgraph, dpi = 220, device = "pdf", width = 18, height = 18)
y_title <- expression("Technological efficiency")
x_title <- expression("Trial")
labeli <- as_labeller(c("I" = "Asocial",
"O" = "Unrepaid",
"V" = "Repaid",
"1"="First Geneartion",
"2"="Second Generation"))
options(repr.plot.width=6., repr.plot.height=6.5)
df %>% ggplot(aes(x=Trial,y=as.numeric(Fitness)))+
geom_line(aes(group =ChainID, color = as.factor(ChainID)), alpha = 0.3)+
geom_point(aes(group =ChainID, color = as.factor(ChainID)),size = 0.7, alpha = 0.5)+
facet_grid(ExpCondition ~ Generation, labeller=labeli ) +
theme_bw() +theme(legend.position = "none")+
stat_summary(fun="mean", geom="line", alpha = 1, size = 0.5) +
stat_summary(fun="mean", geom="point", alpha = 1, size = 0.9)+
ylab(y_title)+xlab(x_title)+
stat_summary(fun = mean,
fun.min = function(x) mean(x) - sd(x)/sqrt(length(x)),
fun.max = function(x) mean(x) + sd(x)/sqrt(length(x)),
alpha = 0.8, geom = "linerange", size =0.5)
ggsave("MEfficienct.pdf", dpi = 220, device = "pdf", width = 6, height = 6.5)
ggsave("MEfficienct.png", dpi = 220, device = "png", width = 6, height = 6.5)
options(repr.plot.width=6, repr.plot.height=3)
g <- ggplot(EfficiencyDf[EfficiencyDf$Generation ==1,], aes(x =as.factor(ExpCondition), y = Efficiency,fill =as.factor(ExpCondition))) +
ggdist::stat_slab( aes(x =as.numeric(as.factor(ExpCondition))+0.1),
alpha = 0.9,
width = .24,
.width = c(0.00002, .92),
) +
geom_jitter(size = 0.7,height=0, width =0.05, alpha = 0.7,aes(x = as.factor(ExpCondition), color =as.factor(ExpCondition))) +
coord_cartesian(xlim = c(1.0, NA), ylim=c(400,800))+theme_bw()+
scale_color_manual(values = CPalet, name = "Condition",labels = c("Asocial", "Unrepaid","Repaid"))+
scale_fill_manual(values = CPalet, name = "Condition",labels = c("Asocial", "Unrepaid","Repaid"))+
ylab(y_title )+xlab("Experimental Conition")+
scale_x_discrete("Condition", labels = c("I" = "Asocial","O" = "Nonrepaid", "V" = "Repaid"))+
stat_summary(fun= mean, geom="bar", alpha = 1, width = 0.2, color = "black",aes(x = as.numeric(as.factor(ExpCondition))-0.2)) +
stat_summary(fun.min = function(x) mean(x) -sd(x)/sqrt(length(x)),
fun.max = function(x) mean(x) + sd(x)/sqrt(length(x)),
geom = "errorbar", width =0.05, aes(x = as.numeric(as.factor(ExpCondition))-0.2))
g
options(repr.plot.width=9, repr.plot.height=3)
g <- ggplot(EfficiencyDf, aes(x =as.factor(ExpCondition), y = Efficiency,fill =as.factor(ExpCondition))) +
ggdist::stat_slab( aes(x =as.numeric(as.factor(ExpCondition))+0.1),
alpha = 0.9,
width = .24,
.width = c(0.00002, .92),
) +
geom_jitter(size = 0.7,height=0, width =0.05, alpha = 0.7,aes(x = as.factor(ExpCondition), color =as.factor(ExpCondition))) +
coord_cartesian(xlim = c(1.0, NA))+theme_bw()+
scale_color_manual(values = CPalet, name = "Condition",labels = c("Asocial", "Unrepaid","Repaid"))+
scale_fill_manual(values = CPalet, name = "Condition",labels = c("Asocial", "Unrepaid","Repaid"))+
ylab(y_title )+xlab("Experimental Conition")+
scale_x_discrete("Condition", labels = c("I" = "Asocial","O" = "Unrepaid", "V" = "Repaid"))+
stat_summary(fun= mean, geom="bar", alpha = 1, width = 0.2, color = "black",aes(x = as.numeric(as.factor(ExpCondition))-0.2)) +
stat_summary(fun.min = function(x) mean(x) -sd(x)/sqrt(length(x)),
fun.max = function(x) mean(x) + sd(x)/sqrt(length(x)),
geom = "errorbar", width =0.05, aes(x = as.numeric(as.factor(ExpCondition))-0.2))+
facet_grid(.~Generation, labeller = labeli )
g
y_title <- expression(paste("Exploration trials (", italic(tau), ")"))
#taulabel<-"a"
taulabel<- expression(italic(tau)*"*")
options(repr.plot.width=6, repr.plot.height=6)
suppressMessages(
suppressWarnings(
g <- ggplot(ExpDf, aes(x =as.factor(ExpCondition), y = Exploration,fill =as.factor(ExpCondition))) +
ggdist::stat_slab( aes(x =as.numeric(as.factor(ExpCondition))+0.1),
alpha = 0.9,
width = .24,
.width = c(0.00002, .92),
) +
geom_jitter(size = 0.7,height=0, width =0.05, alpha = 0.7,aes(x = as.factor(ExpCondition), color =as.factor(ExpCondition))) +
coord_cartesian(xlim = c(1.0, NA))+theme_bw()+
scale_color_manual(values = CPalet, name = "Condition",labels = c("Asocial", "Unrepaid","Repaid"))+
scale_fill_manual(values = CPalet, name = "Condition",labels = c("Asocial", "Unrepaid","Repaid"))+
ylab(y_title )+xlab("Experimental Conition")+
scale_x_discrete("Condition", labels = c("I" = "Asocial","O" = "Unrepaid", "V" = "Repaid"))+
#stat_summary(fun= mean, geom="bar", alpha = 1, width = 0.2, color = "black",aes(x = as.numeric(as.factor(ExpCondition))-0.2)) +
geom_boxplot(alpha=0.7, width =0.2, aes(x = as.numeric(as.factor(ExpCondition))-0.2))+
# geom_segment(aes(x=0.6,xend=1.22,y=12,yend=12),linetype=2, color = "grey39", size = 0.4)+
# geom_segment(aes(x=1.6,xend=2.22,y=12,yend=12),linetype=2, color = "grey39", size = 0.4)+
# geom_segment(aes(x=2.6,xend=3.22,y=22,yend=22),linetype=2, color = "grey39", size = 0.4)+
stat_summary(fun= mean, geom="point", size = 3, shape = 18 , alpha = 1, width = 0.2, color = "black",aes(x = as.numeric(as.factor(ExpCondition))-0.2)) +
stat_summary(fun.min = function(x) mean(x) -sd(x)/sqrt(length(x)),
fun.max = function(x) mean(x) + sd(x)/sqrt(length(x)),
geom = "errorbar", width =0.05, aes(x = as.numeric(as.factor(ExpCondition))-0.2))+
facet_grid(Generation~., labeller = labeli )
#+
#annotate("text",x=1.3,y=0.01+12,label=taulabel) +
#annotate("text",x=2.3,y=0.01+12,label=taulabel) +
#annotate("text",x=3.3,y=0.01+22,label=taulabel)
))
suppressMessages(
suppressWarnings(g)
)
OblOffline<-df[(df$Generation == 1)&(df$ExpCondition == "O"), ]$Fitness
VerOffline<-df[(df$Generation == 1)&(df$ExpCondition == "V"), ]$Fitness
IndOffline<-df[(df$Generation == 1)&(df$ExpCondition == "I"), ]$Fitness
OblOfflineF<-df[(df$Generation == 1)&(df$ExpCondition == "O")&(df$Trial == 50), ]$Fitness
VerOfflineF<-df[(df$Generation == 1)&(df$ExpCondition == "V")&(df$Trial == 50), ]$Fitness
IndOfflineF<-df[(df$Generation == 1)&(df$ExpCondition == "I")&(df$Trial == 50), ]$Fitness
OblOfflineF2<-df[(df$Generation == 2)&(df$ExpCondition == "O")&(df$Trial == 50), ]$Fitness
VerOfflineF2<-df[(df$Generation == 2)&(df$ExpCondition == "V")&(df$Trial == 50), ]$Fitness
"Ind"
psych::describe(IndOfflineF) %>% round(.,2)
"Obl"
psych::describe(OblOfflineF)%>% round(.,2)
"Ver"
psych::describe(VerOfflineF)%>% round(.,2)
| vars | n | mean | sd | median | trimmed | mad | min | max | range | skew | kurtosis | se | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| <dbl> | <dbl> | <dbl> | <dbl> | <dbl> | <dbl> | <dbl> | <dbl> | <dbl> | <dbl> | <dbl> | <dbl> | <dbl> | |
| X1 | 1 | 20 | 820.25 | 69.02 | 830 | 824.44 | 57.82 | 667 | 940 | 273 | -0.51 | -0.42 | 15.43 |
| vars | n | mean | sd | median | trimmed | mad | min | max | range | skew | kurtosis | se | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| <dbl> | <dbl> | <dbl> | <dbl> | <dbl> | <dbl> | <dbl> | <dbl> | <dbl> | <dbl> | <dbl> | <dbl> | <dbl> | |
| X1 | 1 | 20 | 789.9 | 119.59 | 800 | 802.38 | 138.62 | 461 | 940 | 479 | -0.89 | 0.48 | 26.74 |
| vars | n | mean | sd | median | trimmed | mad | min | max | range | skew | kurtosis | se | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| <dbl> | <dbl> | <dbl> | <dbl> | <dbl> | <dbl> | <dbl> | <dbl> | <dbl> | <dbl> | <dbl> | <dbl> | <dbl> | |
| X1 | 1 | 20 | 838.7 | 103.16 | 845.5 | 847.75 | 111.94 | 627 | 975 | 348 | -0.53 | -0.75 | 23.07 |
options(repr.plot.width=9, repr.plot.height=4)
g <- ggplot(df[df$Trial == 50,], aes(x =as.factor(ExpCondition), y =Fitness,fill =as.factor(ExpCondition))) +
ggdist::stat_slab( aes(x =as.numeric(as.factor(ExpCondition))+0.1),
alpha = 0.9,
width = .24,
.width = c(0.00002, .92),
) +
geom_jitter(size = 0.7,height=0, width =0.05, alpha = 0.7,aes(x = as.factor(ExpCondition), color =as.factor(ExpCondition))) +
coord_cartesian(xlim = c(1.0, NA),ylim=c(400,1000))+theme_bw()+
scale_color_manual(values = CPalet, name = "Condition",labels = c("Asocial", "Unrepaid","Repaid"))+
scale_fill_manual(values = CPalet, name = "Condition",labels = c("Asocial", "Unrepaid","Repaid"))+
ylab(y_title )+xlab("Experimental Conition")+
scale_x_discrete("Condition", labels = c("I" = "Asocial","O" = "Nonrepaid", "V" = "Repaid"))+
stat_summary(fun= mean, geom="bar", alpha = 1, width = 0.2, color = "black",aes(x = as.numeric(as.factor(ExpCondition))-0.2)) +
stat_summary(fun.min = function(x) mean(x) -sd(x)/sqrt(length(x)),
fun.max = function(x) mean(x) + sd(x)/sqrt(length(x)),
geom = "errorbar", width =0.05, aes(x = as.numeric(as.factor(ExpCondition))-0.2))+
facet_grid(.~Generation,labeller = labeli)
g
options(repr.plot.width=9, repr.plot.height=4)
g <- ggplot(df[df$Trial == 50,], aes(x =as.factor(ExpCondition), y =Fitness,fill =as.factor(ExpCondition))) +
ggdist::stat_slab( aes(x =as.numeric(as.factor(ExpCondition))+0.1),
alpha = 0.9,
width = .24,
.width = c(0.00002, .92),
) +
geom_jitter(size = 0.7,height=0, width =0.05, alpha = 0.7,aes(x = as.factor(ExpCondition), color =as.factor(ExpCondition))) +
coord_cartesian(xlim = c(1.0, NA),ylim=c(0,1000))+theme_bw()+
scale_color_manual(values = CPalet, name = "Condition",labels = c("Asocial", "Unrepaid","Repaid"))+
scale_fill_manual(values = CPalet, name = "Condition",labels = c("Asocial", "Unnrepaid","Repaid"))+
ylab(y_title )+xlab("Experimental Conition")+
scale_x_discrete("Condition", labels = c("I" = "Asocial","O" = "Nonrepaid", "V" = "Repaid"))+
stat_summary(fun= mean, geom="bar", alpha = 1, width = 0.2, color = "black",aes(x = as.numeric(as.factor(ExpCondition))-0.2)) +
stat_summary(fun.min = function(x) mean(x) -sd(x)/sqrt(length(x)),
fun.max = function(x) mean(x) + sd(x)/sqrt(length(x)),
geom = "errorbar", width =0.05, aes(x = as.numeric(as.factor(ExpCondition))-0.2))+
facet_grid(.~Generation,labeller = labeli)
g
library(exactRankTests)
Package ‘exactRankTests’ is no longer under development. Please consider using package ‘coin’ instead.
t.test(VerOfflineF, IndOfflineF)
t.test(log(VerOfflineF), log(IndOfflineF))
wilcox.exact(VerOfflineF, IndOfflineF,paired=F)
effsize::cohen.d(VerOfflineF, IndOfflineF)
Welch Two Sample t-test data: VerOfflineF and IndOfflineF t = 0.66478, df = 33.171, p-value = 0.5108 alternative hypothesis: true difference in means is not equal to 0 95 percent confidence interval: -38.00408 74.90408 sample estimates: mean of x mean of y 838.70 820.25
Welch Two Sample t-test data: log(VerOfflineF) and log(IndOfflineF) t = 0.51941, df = 33.233, p-value = 0.6069 alternative hypothesis: true difference in means is not equal to 0 95 percent confidence interval: -0.05271388 0.08886949 sample estimates: mean of x mean of y 6.724187 6.706109
Exact Wilcoxon rank sum test data: VerOfflineF and IndOfflineF W = 233.5, p-value = 0.3724 alternative hypothesis: true mu is not equal to 0
Cohen's d
d estimate: 0.2102214 (small)
95 percent confidence interval:
lower upper
-0.4317140 0.8521568
sd(VerOfflineF)
sd(IndOfflineF)
library(exactRankTests)
t.test(OblOfflineF, IndOfflineF)
t.test(log(OblOfflineF), log(IndOfflineF))
wilcox.exact(OblOfflineF, IndOfflineF,paired=F)
effsize::cohen.d(OblOfflineF, IndOfflineF)
Welch Two Sample t-test data: OblOfflineF and IndOfflineF t = -0.98299, df = 30.393, p-value = 0.3334 alternative hypothesis: true difference in means is not equal to 0 95 percent confidence interval: -93.37118 32.67118 sample estimates: mean of x mean of y 789.90 820.25
Welch Two Sample t-test data: log(OblOfflineF) and log(IndOfflineF) t = -1.0998, df = 28.342, p-value = 0.2807 alternative hypothesis: true difference in means is not equal to 0 95 percent confidence interval: -0.13381614 0.04028977 sample estimates: mean of x mean of y 6.659346 6.706109
Exact Wilcoxon rank sum test data: OblOfflineF and IndOfflineF W = 176.5, p-value = 0.5334 alternative hypothesis: true mu is not equal to 0
Cohen's d
d estimate: -0.3108495 (small)
95 percent confidence interval:
lower upper
-0.9548737 0.3331747
sd(OblOfflineF)
t.test(VerOfflineF2, OblOfflineF2)
t.test(log(VerOfflineF2), log(OblOfflineF2))
wilcox.exact(VerOfflineF2, OblOfflineF2,paired=F)
effsize::cohen.d(VerOfflineF2, OblOfflineF2)
Welch Two Sample t-test data: VerOfflineF2 and OblOfflineF2 t = 0.76869, df = 37.976, p-value = 0.4468 alternative hypothesis: true difference in means is not equal to 0 95 percent confidence interval: -30.3853 67.5853 sample estimates: mean of x mean of y 897.85 879.25
Welch Two Sample t-test data: log(VerOfflineF2) and log(OblOfflineF2) t = 0.75387, df = 37.953, p-value = 0.4556 alternative hypothesis: true difference in means is not equal to 0 95 percent confidence interval: -0.03576342 0.07820096 sample estimates: mean of x mean of y 6.796465 6.775246
Exact Wilcoxon rank sum test data: VerOfflineF2 and OblOfflineF2 W = 232, p-value = 0.3945 alternative hypothesis: true mu is not equal to 0
Cohen's d
d estimate: 0.2430811 (small)
95 percent confidence interval:
lower upper
-0.3994484 0.8856105
t.test(OblOfflineF2-OblOfflineF)
#cohen.d(OblOfflineF2-OblOfflineF)
OblCCE<-OblOfflineF2-OblOfflineF
One Sample t-test
data: OblOfflineF2 - OblOfflineF
t = 4.3618, df = 19, p-value = 0.0003357
alternative hypothesis: true mean is not equal to 0
95 percent confidence interval:
46.47505 132.22495
sample estimates:
mean of x
89.35
t.test(VerOfflineF2-VerOfflineF)
#cohen.d(VerOfflineF2-VerOfflineF)
VerCCE<-VerOfflineF2-VerOfflineF
One Sample t-test
data: VerOfflineF2 - VerOfflineF
t = 3.4751, df = 19, p-value = 0.002535
alternative hypothesis: true mean is not equal to 0
95 percent confidence interval:
23.52447 94.77553
sample estimates:
mean of x
59.15
t.test(VerCCE,OblCCE)
Welch Two Sample t-test
data: VerCCE and OblCCE
t = -1.1339, df = 36.767, p-value = 0.2642
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
-84.17601 23.77601
sample estimates:
mean of x mean of y
59.15 89.35
datad<-read.csv("PostQuestionData.csv")
colnames(datad)
datad %>% group_by(., condition, generation) %>%
dplyr::summarize(, n = n(), Str_turn= 2-mean(Str_turn), Str_switch= 2-mean(Str_switch))
datad %>% group_by(., condition, generation) %>%
dplyr::summarize(, n = n(), Str_turn= (2-mean(Str_turn))*20, Str_switch= (2-mean(Str_switch))*20)
`summarise()` has grouped output by 'condition'. You can override using the `.groups` argument.
| condition | generation | n | Str_turn | Str_switch |
|---|---|---|---|---|
| <chr> | <int> | <int> | <dbl> | <dbl> |
| I | 1 | 20 | 0.85 | 0.80 |
| O | 1 | 20 | 0.85 | 0.65 |
| O | 2 | 20 | 0.75 | 1.00 |
| V | 1 | 20 | 0.80 | 0.40 |
| V | 2 | 20 | 0.65 | 0.95 |
`summarise()` has grouped output by 'condition'. You can override using the `.groups` argument.
| condition | generation | n | Str_turn | Str_switch |
|---|---|---|---|---|
| <chr> | <int> | <int> | <dbl> | <dbl> |
| I | 1 | 20 | 17 | 16 |
| O | 1 | 20 | 17 | 13 |
| O | 2 | 20 | 15 | 20 |
| V | 1 | 20 | 16 | 8 |
| V | 2 | 20 | 13 | 19 |
datad %>% group_by(., condition, generation) %>%
dplyr::summarize(, n = n(), Mingore_cost=round(mean (ignore_cost, na.rm = TRUE),2),
SDingore_cost=round(sd(ignore_cost, na.rm = TRUE),2),
Moverspent=mean(overspent),
SDoverspent=sd(overspent)%>%round(2),
Mmorespent=mean(more_spent),
SDmorespent=sd(more_spent)%>%round(2),
Mmaximize=mean(maxim),
SDmaximize=sd(maxim)%>%round(2))
datad %>% group_by(., condition, generation) %>%
dplyr::summarize(, n = n(),
MFutureThink=mean(FutureThink),
SFutureThink=sd(FutureThink)%>%round(2),
MAncestor=mean(Ancestor),
SAncestor=sd(Ancestor)%>%round(2),
MReturn=mean(Return),
SReturn=sd(Return)%>%round(2))
`summarise()` has grouped output by 'condition'. You can override using the `.groups` argument.
| condition | generation | n | Mingore_cost | SDingore_cost | Moverspent | SDoverspent | Mmorespent | SDmorespent | Mmaximize | SDmaximize |
|---|---|---|---|---|---|---|---|---|---|---|
| <chr> | <int> | <int> | <dbl> | <dbl> | <dbl> | <dbl> | <dbl> | <dbl> | <dbl> | <dbl> |
| I | 1 | 20 | 3.10 | 1.94 | 3.15 | 1.73 | 5.05 | 1.36 | 2.60 | 1.50 |
| O | 1 | 20 | 3.84 | 1.68 | 4.40 | 1.90 | 4.50 | 1.76 | 3.30 | 1.56 |
| O | 2 | 20 | 3.85 | 1.66 | 4.90 | 1.92 | 5.45 | 1.57 | 1.80 | 1.15 |
| V | 1 | 20 | 2.60 | 1.60 | 4.50 | 2.04 | 4.50 | 2.01 | 2.15 | 1.50 |
| V | 2 | 20 | 4.20 | 2.07 | 4.85 | 2.16 | 5.75 | 1.21 | 2.55 | 1.43 |
`summarise()` has grouped output by 'condition'. You can override using the `.groups` argument.
| condition | generation | n | MFutureThink | SFutureThink | MAncestor | SAncestor | MReturn | SReturn |
|---|---|---|---|---|---|---|---|---|
| <chr> | <int> | <int> | <dbl> | <dbl> | <dbl> | <dbl> | <dbl> | <dbl> |
| I | 1 | 20 | NA | NA | NA | NA | NA | NA |
| O | 1 | 20 | 4.5 | 1.61 | NA | NA | NA | NA |
| O | 2 | 20 | NA | NA | 2.75 | 1.77 | 4.1 | 1.55 |
| V | 1 | 20 | 2.8 | 1.94 | NA | NA | NA | NA |
| V | 2 | 20 | NA | NA | 2.20 | 1.32 | 2.3 | 1.53 |
PROSOC_KEY<-c(3,2,1,3,2,1,1,3,2)
PROSELF_KEY<-c(2,1,3,2,1,3,2,1,3)
COMP_KEY <-c(1,3,2,1,3,2,3,2,1)
SVO<-datad[,(dim(datad)[2]-8):dim(datad)[2]]
PSocScore<-apply(SVO==matrix(PROSOC_KEY,dim(SVO)[1],dim(SVO)[2],T) ,1, sum)
PSelfScore<-apply(SVO==matrix(PROSELF_KEY,dim(SVO)[1],dim(SVO)[2],T) ,1, sum)
CompScore<-apply(SVO==matrix(COMP_KEY,dim(SVO)[1],dim(SVO)[2],T) ,1, sum)
datadp<-mutate(datad, PSocScore,PSelfScore,CompScore)
#mean(datadp[(datadp$condition=="I")&(datadp$generation==1),]$PSocScore)
#mean(datadp[(datadp$condition=="O")&(datadp$generation==1),]$PSocScore)
#mean(datadp[(datadp$condition=="V")&(datadp$generation==1),]$PSocScore)
#mean(datadp[(datadp$condition=="O")&(datadp$generation==2),]$PSocScore)
#mean(datadp[(datadp$condition=="V")&(datadp$generation==2),]$PSocScore)
SVO_cat<-numeric(dim(datad)[1])
SVO_cat[PSocScore > 5.9]<-"C"
SVO_cat[PSocScore < 5.9]<-"N"
SVO_cat[9-PSocScore > 5.9]<-"D"
#SVO_cat
IfSocial<-numeric(dim(datad)[1])
IfSocial[PSocScore > 5.9]<-1
datadp<-mutate(datadp, SVO_cat,IfSocial)
datadp %>% group_by(., condition, generation) %>%
dplyr::summarize(, n = n(), psoc_m = mean(PSocScore), psoc_sd = round(sd(PSocScore), 2),
pself_m = mean(PSelfScore), pself_sd = round(sd(PSelfScore),2),
comp_m = mean(CompScore), comp_sd = round(sd(CompScore),2)) -> table_svo
table_svo
`summarise()` has grouped output by 'condition'. You can override using the `.groups` argument.
| condition | generation | n | psoc_m | psoc_sd | pself_m | pself_sd | comp_m | comp_sd |
|---|---|---|---|---|---|---|---|---|
| <chr> | <int> | <int> | <dbl> | <dbl> | <dbl> | <dbl> | <dbl> | <dbl> |
| I | 1 | 20 | 4.85 | 3.62 | 4.15 | 3.62 | 0.00 | 0.00 |
| O | 1 | 20 | 5.00 | 4.34 | 3.95 | 4.29 | 0.05 | 0.22 |
| O | 2 | 20 | 4.75 | 3.95 | 4.20 | 3.93 | 0.00 | 0.00 |
| V | 1 | 20 | 4.55 | 4.07 | 4.40 | 4.07 | 0.05 | 0.22 |
| V | 2 | 20 | 4.25 | 4.27 | 4.70 | 4.22 | 0.05 | 0.22 |
#latex(table_svo, file = "table_svo_dexc.tex")
(table(datadp[datadp$generation ==1,]$condition, datadp[datadp$generation ==1,]$SVO_cat)) ->G1SVO
(G1SVO)
(G1SVO)/20
C D N
I 10 9 1
O 11 8 1
V 9 9 2
C D N
I 0.50 0.45 0.05
O 0.55 0.40 0.05
V 0.45 0.45 0.10
(table(datadp[datadp$generation ==2,]$condition, datadp[datadp$generation ==2,]$SVO_cat)) ->G2SVO
(G2SVO)
(G2SVO)/20
C D N
O 10 10 0
V 9 10 1
C D N
O 0.50 0.50 0.00
V 0.45 0.50 0.05
(table(datadp[datadp$generation ==1,]$condition, datadp[datadp$generation ==1,]$IfSocial))
0 1
I 10 10
O 9 11
V 11 9
(table(datadp[datadp$generation ==1,]$condition, datadp[datadp$generation ==1,]$IfSocial)) ->G1IfSocial
G1IfSocial
G1IfSocial/20
0 1
I 10 10
O 9 11
V 11 9
0 1
I 0.50 0.50
O 0.45 0.55
V 0.55 0.45
ExpDfSVO<-mutate(ExpDf, SVO_cat, IfSocial,PSocScore)
filter(ExpDfSVO, Generation == 1) -> ExpDfSVOG1
head(ExpDfSVO)
| ID | Exploration | Generation | ExpCondition | SessionID | Gender | SVO_cat | IfSocial | PSocScore | |
|---|---|---|---|---|---|---|---|---|---|
| <int> | <dbl> | <int> | <chr> | <int> | <int> | <chr> | <dbl> | <int> | |
| 1 | 1 | 18 | 1 | I | 1 | 1 | C | 1 | 6 |
| 2 | 2 | 17 | 1 | I | 2 | 3 | D | 0 | 1 |
| 3 | 3 | 21 | 1 | I | 3 | 3 | D | 0 | 0 |
| 4 | 4 | 22 | 1 | I | 4 | 3 | C | 1 | 8 |
| 5 | 5 | 19 | 1 | I | 5 | 2 | C | 1 | 8 |
| 6 | 6 | 24 | 1 | I | 6 | 2 | C | 1 | 9 |
Gaus_cat<-lm(data = ExpDfSVOG1, Exploration~ExpCondition+IfSocial)
summary(Gaus_cat)
AIC(Gaus_cat)
Call:
lm(formula = Exploration ~ ExpCondition + IfSocial, data = ExpDfSVOG1)
Residuals:
Min 1Q Median 3Q Max
-12.3287 -2.8776 -0.3287 3.8656 12.1780
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 20.3466 1.3821 14.721 <2e-16 ***
ExpConditionO -0.6253 1.6927 -0.369 0.7132
ExpConditionV 4.4753 1.6927 2.644 0.0106 *
IfSocial -0.4933 1.3856 -0.356 0.7232
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 5.348 on 56 degrees of freedom
Multiple R-squared: 0.1657, Adjusted R-squared: 0.1211
F-statistic: 3.709 on 3 and 56 DF, p-value: 0.01666
apa.reg.table(Gaus_cat)
Regression results using Exploration as the criterion
Predictor b b_95%_CI sr2 sr2_95%_CI Fit
(Intercept) 20.35** [17.58, 23.12]
ExpConditionO -0.63 [-4.02, 2.77] .00 [-.02, .02]
ExpConditionV 4.48* [1.08, 7.87] .10 [-.04, .25]
IfSocial -0.49 [-3.27, 2.28] .00 [-.02, .02]
R2 = .166*
95% CI[.01,.31]
Note. A significant b-weight indicates the semi-partial correlation is also significant.
b represents unstandardized regression weights.
sr2 represents the semi-partial correlation squared.
Square brackets are used to enclose the lower and upper limits of a confidence interval.
* indicates p < .05. ** indicates p < .01.
$Y_i = \beta_0 + \beta_1X_{unrepaid} + \beta_2X_{repaid} + \beta_3X_{prosicail} + \varepsilon$
Gaus_cat_scale<-lm(data = ExpDfSVOG1, scale(Exploration)~ExpCondition+IfSocial)
summary(Gaus_cat_scale)
AIC(Gaus_cat_scale)
Call:
lm(formula = scale(Exploration) ~ ExpCondition + IfSocial, data = ExpDfSVOG1)
Residuals:
Min 1Q Median 3Q Max
-2.16108 -0.50442 -0.05762 0.67761 2.13467
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -0.18172 0.24227 -0.750 0.4564
ExpConditionO -0.10961 0.29672 -0.369 0.7132
ExpConditionV 0.78448 0.29672 2.644 0.0106 *
IfSocial -0.08647 0.24288 -0.356 0.7232
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 0.9375 on 56 degrees of freedom
Multiple R-squared: 0.1657, Adjusted R-squared: 0.1211
F-statistic: 3.709 on 3 and 56 DF, p-value: 0.01666
options(digits=2)
summary(Gaus_cat_scale)$coefficients
| Estimate | Std. Error | t value | Pr(>|t|) | |
|---|---|---|---|---|
| (Intercept) | -0.182 | 0.24 | -0.75 | 0.456 |
| ExpConditionO | -0.110 | 0.30 | -0.37 | 0.713 |
| ExpConditionV | 0.784 | 0.30 | 2.64 | 0.011 |
| IfSocial | -0.086 | 0.24 | -0.36 | 0.723 |
apa.reg.table(Gaus_cat_scale)
Regression results using scale(Exploration) as the criterion
Predictor b b_95%_CI sr2 sr2_95%_CI Fit
(Intercept) -0.18 [-0.67, 0.30]
ExpConditionO -0.11 [-0.70, 0.48] .00 [-.02, .02]
ExpConditionV 0.78* [0.19, 1.38] .10 [-.04, .25]
IfSocial -0.09 [-0.57, 0.40] .00 [-.02, .02]
R2 = .166*
95% CI[.01,.31]
Note. A significant b-weight indicates the semi-partial correlation is also significant.
b represents unstandardized regression weights.
sr2 represents the semi-partial correlation squared.
Square brackets are used to enclose the lower and upper limits of a confidence interval.
* indicates p < .05. ** indicates p < .01.
Gaus_cont<-lm(data = ExpDfSVOG1, Exploration~ExpCondition+PSocScore)
summary(Gaus_cont)
AIC(Gaus_cont)
Gaus_cont_scale<-lm(data = ExpDfSVOG1, scale(Exploration)~ExpCondition+scale(PSocScore))
summary(Gaus_cont_scale)
AIC(Gaus_cont_scale)
Call:
lm(formula = Exploration ~ ExpCondition + PSocScore, data = ExpDfSVOG1)
Residuals:
Min 1Q Median 3Q Max
-11.845 -3.325 -0.011 3.801 11.661
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 20.905 1.480 14.13 <2e-16 ***
ExpConditionO -0.608 1.681 -0.36 0.719
ExpConditionV 4.434 1.682 2.64 0.011 *
PSocScore -0.166 0.182 -0.91 0.365
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 5.3 on 56 degrees of freedom
Multiple R-squared: 0.176, Adjusted R-squared: 0.132
F-statistic: 3.99 on 3 and 56 DF, p-value: 0.012
Call:
lm(formula = scale(Exploration) ~ ExpCondition + scale(PSocScore),
data = ExpDfSVOG1)
Residuals:
Min 1Q Median 3Q Max
-2.0762 -0.5829 -0.0019 0.6663 2.0441
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -0.223 0.208 -1.07 0.288
ExpConditionO -0.107 0.295 -0.36 0.719
ExpConditionV 0.777 0.295 2.64 0.011 *
scale(PSocScore) -0.111 0.122 -0.91 0.365
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 0.93 on 56 degrees of freedom
Multiple R-squared: 0.176, Adjusted R-squared: 0.132
F-statistic: 3.99 on 3 and 56 DF, p-value: 0.012
options(digits=2)
summary(Gaus_cont_scale)$coefficients
| Estimate | Std. Error | t value | Pr(>|t|) | |
|---|---|---|---|---|
| (Intercept) | -0.22 | 0.21 | -1.07 | 0.288 |
| ExpConditionO | -0.11 | 0.29 | -0.36 | 0.719 |
| ExpConditionV | 0.78 | 0.29 | 2.64 | 0.011 |
| scale(PSocScore) | -0.11 | 0.12 | -0.91 | 0.365 |
apa.reg.table(Gaus_cont_scale)
Regression results using scale(Exploration) as the criterion
Predictor b b_95%_CI sr2 sr2_95%_CI Fit
(Intercept) -0.22 [-0.64, 0.19]
ExpConditionO -0.11 [-0.70, 0.48] .00 [-.02, .02]
ExpConditionV 0.78* [0.19, 1.37] .10 [-.04, .24]
scale(PSocScore) -0.11 [-0.35, 0.13] .01 [-.04, .06]
R2 = .176*
95% CI[.01,.32]
Note. A significant b-weight indicates the semi-partial correlation is also significant.
b represents unstandardized regression weights.
sr2 represents the semi-partial correlation squared.
Square brackets are used to enclose the lower and upper limits of a confidence interval.
* indicates p < .05. ** indicates p < .01.
Pois_additive<-glm(data = ExpDfSVOG1, Exploration~ExpCondition+IfSocial, family = poisson(link="identity"))
Pois_additive_log<-glm(data = ExpDfSVOG1, Exploration~ExpCondition+IfSocial, family = poisson(link="log"))
summary(Pois_additive)
summary(Pois_additive_log)
#apa.reg.table(Pois_additive)
Call:
glm(formula = Exploration ~ ExpCondition + IfSocial, family = poisson(link = "identity"),
data = ExpDfSVOG1)
Deviance Residuals:
Min 1Q Median 3Q Max
-2.9173 -0.6437 -0.0827 0.8330 2.2941
Coefficients:
Estimate Std. Error z value Pr(>|z|)
(Intercept) 20.275 1.169 17.35 <2e-16 ***
ExpConditionO -0.639 1.408 -0.45 0.6498
ExpConditionV 4.467 1.496 2.99 0.0028 **
IfSocial -0.335 1.192 -0.28 0.7788
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
(Dispersion parameter for poisson family taken to be 1)
Null deviance: 91.645 on 59 degrees of freedom
Residual deviance: 77.163 on 56 degrees of freedom
AIC: 377.4
Number of Fisher Scoring iterations: 5
Call:
glm(formula = Exploration ~ ExpCondition + IfSocial, family = poisson(link = "log"),
data = ExpDfSVOG1)
Deviance Residuals:
Min 1Q Median 3Q Max
-2.9066 -0.6570 -0.0586 0.8465 2.2697
Coefficients:
Estimate Std. Error z value Pr(>|z|)
(Intercept) 3.0122 0.0570 52.80 <2e-16 ***
ExpConditionO -0.0317 0.0712 -0.45 0.6559
ExpConditionV 0.2009 0.0673 2.99 0.0028 **
IfSocial -0.0231 0.0560 -0.41 0.6805
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
(Dispersion parameter for poisson family taken to be 1)
Null deviance: 91.645 on 59 degrees of freedom
Residual deviance: 77.071 on 56 degrees of freedom
AIC: 377.3
Number of Fisher Scoring iterations: 4
gression results using Exploration as the criterion
Predictor b b_95%_CI sr2 sr2_95%_CI Fit
(Intercept) 20.35** [17.58, 23.12]
ExpConditionO -0.63 [-4.02, 2.77] .00 [-.02, .02]
ExpConditionV 4.48* [1.08, 7.87] .10 [-.04, .25]
IfSocial -0.49 [-3.27, 2.28] .00 [-.02, .02]
R2 = .166*
95% CI[NA,NA]
Note. A significant b-weight indicates the semi-partial correlation is also significant. b represents unstandardized regression weights. sr2 represents the semi-partial correlation squared. Square brackets are used to enclose the lower and upper limits of a confidence interval.
options(digits=3)
BInomial_cat<-glm(data = ExpDfSVOG1,cbind(Exploration, 50-Exploration)~ExpCondition+IfSocial, family =binomial)
summary(BInomial_cat)
Call:
glm(formula = cbind(Exploration, 50 - Exploration) ~ ExpCondition +
IfSocial, family = binomial, data = ExpDfSVOG1)
Deviance Residuals:
Min 1Q Median 3Q Max
-3.582 -0.838 -0.091 1.110 3.513
Coefficients:
Estimate Std. Error z value Pr(>|z|)
(Intercept) -0.3769 0.0744 -5.07 4.0e-07 ***
ExpConditionO -0.0524 0.0916 -0.57 0.57
ExpConditionV 0.3631 0.0904 4.02 5.9e-05 ***
IfSocial -0.0407 0.0744 -0.55 0.58
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
(Dispersion parameter for binomial family taken to be 1)
Null deviance: 161.35 on 59 degrees of freedom
Residual deviance: 135.44 on 56 degrees of freedom
AIC: 401.1
Number of Fisher Scoring iterations: 4
options(digits=1)
summary(BInomial_cat)$coefficients
| Estimate | Std. Error | z value | Pr(>|z|) | |
|---|---|---|---|---|
| (Intercept) | -0.38 | 0.07 | -5.1 | 4e-07 |
| ExpConditionO | -0.05 | 0.09 | -0.6 | 6e-01 |
| ExpConditionV | 0.36 | 0.09 | 4.0 | 6e-05 |
| IfSocial | -0.04 | 0.07 | -0.5 | 6e-01 |
options(digits=3)
summary(BInomial_cat)$coefficients
| Estimate | Std. Error | z value | Pr(>|z|) | |
|---|---|---|---|---|
| (Intercept) | -0.3769 | 0.0744 | -5.067 | 4.05e-07 |
| ExpConditionO | -0.0524 | 0.0916 | -0.572 | 5.67e-01 |
| ExpConditionV | 0.3631 | 0.0904 | 4.016 | 5.91e-05 |
| IfSocial | -0.0407 | 0.0744 | -0.547 | 5.85e-01 |
AIC(BInomial_cat)
BInomial_cont_scale<-glm(data = ExpDfSVOG1,cbind(Exploration, 50-Exploration)~ExpCondition+scale(PSocScore), family =binomial)
summary(BInomial_cont_scale)
Call:
glm(formula = cbind(Exploration, 50 - Exploration) ~ ExpCondition +
scale(PSocScore), family = binomial, data = ExpDfSVOG1)
Deviance Residuals:
Min 1Q Median 3Q Max
-3.454 -0.967 0.002 1.090 3.366
Coefficients:
Estimate Std. Error z value Pr(>|z|)
(Intercept) -0.3967 0.0645 -6.15 7.8e-10 ***
ExpConditionO -0.0510 0.0915 -0.56 0.58
ExpConditionV 0.3599 0.0904 3.98 6.9e-05 ***
scale(PSocScore) -0.0522 0.0374 -1.39 0.16
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
(Dispersion parameter for binomial family taken to be 1)
Null deviance: 161.35 on 59 degrees of freedom
Residual deviance: 133.80 on 56 degrees of freedom
AIC: 399.4
Number of Fisher Scoring iterations: 4
options(digits=1)
summary(BInomial_cont_scale)$coefficients
| Estimate | Std. Error | z value | Pr(>|z|) | |
|---|---|---|---|---|
| (Intercept) | -0.40 | 0.06 | -6.1 | 8e-10 |
| ExpConditionO | -0.05 | 0.09 | -0.6 | 6e-01 |
| ExpConditionV | 0.36 | 0.09 | 4.0 | 7e-05 |
| scale(PSocScore) | -0.05 | 0.04 | -1.4 | 2e-01 |
options(digits=3)
summary(BInomial_cont_scale)$coefficients
| Estimate | Std. Error | z value | Pr(>|z|) | |
|---|---|---|---|---|
| (Intercept) | -0.3967 | 0.0645 | -6.149 | 7.81e-10 |
| ExpConditionO | -0.0510 | 0.0915 | -0.558 | 5.77e-01 |
| ExpConditionV | 0.3599 | 0.0904 | 3.979 | 6.92e-05 |
| scale(PSocScore) | -0.0522 | 0.0374 | -1.393 | 1.64e-01 |
AIC(BInomial_cont_scale)
BInomial_cont<-glm(data = ExpDfSVOG1,cbind(Exploration, 50-Exploration)~ExpCondition+PSocScore, family =binomial)
BInomial_cont
Call: glm(formula = cbind(Exploration, 50 - Exploration) ~ ExpCondition +
PSocScore, family = binomial, data = ExpDfSVOG1)
Coefficients:
(Intercept) ExpConditionO ExpConditionV PSocScore
-0.3311 -0.0510 0.3599 -0.0137
Degrees of Freedom: 59 Total (i.e. Null); 56 Residual
Null Deviance: 161
Residual Deviance: 134 AIC: 399
options(digits=2)
summary(BInomial_cont)
Call:
glm(formula = cbind(Exploration, 50 - Exploration) ~ ExpCondition +
PSocScore, family = binomial, data = ExpDfSVOG1)
Deviance Residuals:
Min 1Q Median 3Q Max
-3.454 -0.967 0.002 1.090 3.366
Coefficients:
Estimate Std. Error z value Pr(>|z|)
(Intercept) -0.33106 0.07997 -4.14 3.5e-05 ***
ExpConditionO -0.05105 0.09153 -0.56 0.58
ExpConditionV 0.35987 0.09044 3.98 6.9e-05 ***
PSocScore -0.01367 0.00981 -1.39 0.16
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
(Dispersion parameter for binomial family taken to be 1)
Null deviance: 161.35 on 59 degrees of freedom
Residual deviance: 133.80 on 56 degrees of freedom
AIC: 399.4
Number of Fisher Scoring iterations: 4
options(digits=1)
summary(BInomial_cont)$coefficients
| Estimate | Std. Error | z value | Pr(>|z|) | |
|---|---|---|---|---|
| (Intercept) | -0.33 | 0.08 | -4.1 | 3e-05 |
| ExpConditionO | -0.05 | 0.09 | -0.6 | 6e-01 |
| ExpConditionV | 0.36 | 0.09 | 4.0 | 7e-05 |
| PSocScore | -0.01 | 0.01 | -1.4 | 2e-01 |
options(digits=3)
summary(BInomial_cont)$coefficients
| Estimate | Std. Error | z value | Pr(>|z|) | |
|---|---|---|---|---|
| (Intercept) | -0.3311 | 0.07997 | -4.140 | 3.48e-05 |
| ExpConditionO | -0.0510 | 0.09153 | -0.558 | 5.77e-01 |
| ExpConditionV | 0.3599 | 0.09044 | 3.979 | 6.92e-05 |
| PSocScore | -0.0137 | 0.00981 | -1.393 | 1.64e-01 |
AIC(BInomial_cont)
AIC(Gaus_cont_scale,Gaus_cat_scale,BInomial_cont_scale,BInomial_cat)
| df | AIC | |
|---|---|---|
| <dbl> | <dbl> | |
| Gaus_cont_scale | 5 | 168 |
| Gaus_cat_scale | 5 | 168 |
| BInomial_cont_scale | 4 | 399 |
| BInomial_cat | 4 | 401 |